uni-app 自定义事件
// inner.vuesubmit(){this.loading = truevar nameList = []nameList = this.person.filter(item => item.checked===true)this.checkedName = nameList.map(item => item.operators)uni.$emit('...
·
// inner.vue
submit(){
this.loading = true
var nameList = []
nameList = this.person.filter(item => item.checked===true)
this.checkedName = nameList.map(item => item.operators)
uni.$emit('select-repair-person',{operators:this.checkedName})
uni.navigateBack({
delta: 1
})
}
过滤出选中的item,再遍历拿出每个item的operators。放到checkedName里。定义自定义事件select-repair-person
// outer.vue
created() {
this.orderId = this.getParams()
this.getRepairOrderDetails()
uni.$on('select-repair-person',(data) => {
this.getName = data.operators
})
},
监听自定义事件,拿到数据
onShow() {
this.pushPerson()
},
pushPerson() {
for (var i = 0; i < this.getName.length; i++) {
var obj = {}
obj.operators = this.getName[i]
obj.costTime = ''
obj.repairDetails = ''
this.repairPerson.push(obj)
}
},
onshow周期函数,在页面每次显示出的时候调用
更多推荐
已为社区贡献1条内容
所有评论(0)