微信小程序开发 wepy使用

wepy官网:https://tencent.github.io/wepy/document.html,想要了解全面最好去官网,以下只是指出项目里常用地方。

1.页面跳转

(1)//有返回跳转
wepy.navigateTo({
url: "/pages/address_add"
});

(2)//无返回跳转
wepy.switchTab({
url: '/pages/shop_cart'
})

2组件间通信

(1)//指定执行某个组件里的方法

this.$invoke('comAddress', 'getLocationInfo');

(2)由子组件发起向父组件调用某方法

that.$emit('selectCode', that.code);

3数据 / 缓存
wepy.$store.dispatch({type: CHANGE_CART, payload: {goodCartList: that.cartList}});

猜你喜欢

转载自www.cnblogs.com/GGDong/p/11899555.html