export default {
    trigger: function (item, wx, data) {
        let resultItem;
        if (typeof item === 'string') {
            resultItem = { name: item };
        }
        else {
            resultItem = item;
        }
        return wx.$router[resultItem.mode || 'navigateTo']({...resultItem, params: this.createParams(item, wx, data) });
    },
    createParams: function (item, wx, data) {
        if (typeof item.params === 'function') {
            return item.params.call(wx, data);
        }
        else {
            return item.params;
        }
    }
}