模板中添加事件
<uni-data-picker :step-searh="true" self-field="_id" parent-field="parent_id" v-model="formData.d_ids" collection="opendb-department" field="_id as value, name as text,parent_id" @nodeclick="nodeclick" @popupclosed="popupclosed"></uni-data-picker>
data()函数的return部分添加个变量
return {
tempPdid:"",
方法中添加上面事件对应的方法
methods: {
nodeclick(e){
this.tempPdid = e.value
},
popupclosed(){
this.formData.d_ids = this.tempPdid // 这个例子是用户修改页,d_ids是uni-id-users表的部门字段
},
操作效果:点击任意节点,再点击选框之外,会自动关闭选框,选项即生效。
0 个评论
要回复文章请先登录或注册