WXL
3 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/@dcloudio/uni-ui/lib/uni-collapse/uni-collapse.vue
@@ -51,8 +51,11 @@
         }
      },
      watch: {
         dataValue(val) {
            this.setOpen(val)
         dataValue: {
            handler(newVal) {
               this.setOpen(newVal)
            },
            deep: true
         }
      },
      created() {
@@ -66,9 +69,9 @@
      },
      methods: {
         setOpen(val) {
            let str = typeof val === 'string'
            let arr = Array.isArray(val)
            this.childrens.forEach((vm, index) => {
            const str = typeof val === 'string'
            const arr = Array.isArray(val)
            this.childrens.forEach((vm) => {
               if (str) {
                  if (val === vm.nameSync) {
                     if (!this.accordion) {
@@ -79,15 +82,12 @@
                  }
               }
               if (arr) {
                  val.forEach(v => {
                     if (v === vm.nameSync) {
                        if (this.accordion) {
                           console.warn('accordion 属性为 true ,v-model 类型应该为 string')
                           return
                        }
                        vm.isOpen = true
                     }
                  })
                  const isOpen = val.findIndex(v => v === vm.nameSync) !== -1
                  if (this.accordion && isOpen) {
                     console.warn('accordion 属性为 true ,v-model 类型应该为 string')
                     return
                  }
                  vm.isOpen = isOpen
               }
            })
            this.emit(val)