<uni-data-picker v-model="formData.address" :border="false" preload placeholder="请选择区域" popup-title="请选择建筑" collection="dorm" field="code as value, name as text" orderby="value asc" :step-searh="true" self-field="code" parent-field="parent_code"
@change="onchange" ></uni-data-picker>
uni-data-picker组件直接配合uniCloud云数据使用,但是每次选完值后,绑定的formData.address的值确实跟着改变了,但是却没有渲染在页面上,最后利用 this.$nextTickc重新渲染dom解决,代码如下:
// 将选中的宿舍地址的文本存放进数据中
onchange(e) {
const value = e.detail.value
// 利用this.$nextTick解决选择地址结束后不显示的问题
let that = this
this.$nextTick(() => {
that.formData.address=value[0].text+"/"+value[1].text+"/"+value[2].text
})
},