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

const appData = {
    yohobuyLimitChannel: {
        appId: 'wxed31f9e8705fb8d1',
        page: {
            limitProductList: 'pages/index/index'
        }
    },
    groupBuy: { // 拼团
        appId: 'wx207f18be42db9028',
        page: {
            home: '/pages/group/home'
        }
    },
    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);
}