uniapp 原生自带,偷懒搬个demo 传送门<template>
<view class="page-body">
<page-head title="movable-view,可拖动视图"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title uni-commo- 阅读剩余部分 -
实现原理是基于uniapp的uni.$on、uni.$emit uni.$off监听实现的。首先在当前页面增加onUnload生命周期函数 onUnload() {
uni.$emit('refresh');
},
然后在上一级组件里面增加onLoad(opts){
console.log('opts',opts)
uni.$on('refresh',() => {
this.getWorkOrderUnShelveMaterialList()
})
},
onUnload(){
console.log('onUnload')
- 阅读剩余部分 -
在Page_A页面跳转到 Page_B页面传参时,如下uni.navigateTo({
url: `/pages/KanbanMaterialRemoval/circuitList?materialNo=${item.materialNo}&taskId=${item.id}&offShelvesQty=${item.offShelvesQty}`
});
发现在Page_B页面用$route.query接收参数的时候发现在h5页面是好使的但是在打包成app就不好使了,需要使用onload来接收,感觉很像小程序写法onLoad(o- 阅读剩余部分 -
最近在折腾uniapp 需要额外传参,这里坐下笔记<uni-easyinput type="text" v-model.trim="item.offShelvesQty" @input="onInputOffShelvesQty($event,index,item)"/>