Browse Source

表单组件 修改下拉选择功能

master
邓宏 2 years ago
parent
commit
66ed2e26f7
  1. 13
      uni_modules/d-form/components/d-form/d-form.vue

13
uni_modules/d-form/components/d-form/d-form.vue

@ -327,10 +327,14 @@ import {computeArea} from '@/common/utils'
function setPickerCol(columns, value, n){ function setPickerCol(columns, value, n){
if(columns.length<=0)return if(columns.length<=0)return
var v=value[n-1]||0 var v=value[n-1]
if(columns[v]?.children){ if(v){
this.setColumnValues(n,columns[v].children) for(var i in columns){
setPickerCol(columns[v].children, value, ++n) if(columns[i].value==v&&columns[i].children){
this.setColumnValues(n,columns[i].children)
setPickerCol(columns[i].children, value, ++n)
}
}
} }
} }
function setPickerVal(columns, value){ function setPickerVal(columns, value){
@ -436,6 +440,7 @@ import {computeArea} from '@/common/utils'
watch:{ watch:{
columns(n){ columns(n){
if(this.type=='select'){ if(this.type=='select'){
console.log(n[0],this.value)
this.$nextTick(()=>{ this.$nextTick(()=>{
setPickerCol.bind(this.$refs.picker)(n[0]||[],this.value,1) setPickerCol.bind(this.$refs.picker)(n[0]||[],this.value,1)
}) })

Loading…
Cancel
Save