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

const appData = {
  yohobuy: {
    appId: 'wx084ab813d88c594b',
    page: {
      productDetail: '/pages/goodsDetail/goodsDetail',
      brandDetail: '/pages/goodsList/brand'
    }
  },
  anotherApp: {
    appId: 'wx084ab813d88c594b',
    page: {
      home: '/pages/goodsDetail/goodsDetail'
    }
  },
};

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);
}