jump-to-miniapp.js 664 Bytes
import wx from '../utils/wx';
import {stringify} from '../vendors/query-string';

const appData = {
    yohobuyLimitChannel: {
        appId: 'wxed31f9e8705fb8d1',
        page: {
            limitProductList: 'pages/index/index'
        }
    },
    anotherApp: {
        appId: 'wx084ab813d88c594b',
        page: {
            home: '/pages/product/detail/detail'
        }
    },
};

export default function(params) {
    let navigateToMiniParams = {
        appId: appData[params.app].appId,
        path: params.path || `${appData[params.app].page[params.page]}?${stringify(params.data)}`
    };

    return wx.navigateToMiniProgram(navigateToMiniParams);
}