sadais-piui 1.2.7-beta38 → 1.2.7-beta39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@
6
6
  </template>
7
7
 
8
8
  <script>
9
+ import ValueSync from '../../mixin/value-sync'
9
10
  import { getConfig } from '../../config'
10
11
  const { collapse } = getConfig()
11
12
  /**
@@ -17,6 +18,8 @@ const { collapse } = getConfig()
17
18
  */
18
19
  export default {
19
20
  name: 'PiCollapse',
21
+ // 混入v-model
22
+ mixins: [ValueSync],
20
23
  props: {
21
24
  // 当前展开面板的name,非手风琴模式:[<string | number>],手风琴模式:string | number
22
25
  value: {
@@ -110,7 +113,8 @@ export default {
110
113
  })
111
114
  })
112
115
  // 触发change事件
113
- this.$emit('change', changeArr)
116
+ this.val = changeArr
117
+ this.handleEmitChange()
114
118
  this.$emit(target.expanded ? 'open' : 'close', target.name)
115
119
  }
116
120
  }
@@ -164,17 +164,18 @@ export default {
164
164
  if (!this.parent) {
165
165
  return console.error('pi-collapse-item必须要搭配pi-collapse组件使用')
166
166
  }
167
- const { value, accordion } = this.parent
167
+ const { val, accordion } = this.parent
168
+ console.log('折叠面板item初始化', val, accordion)
168
169
  if (accordion) {
169
- if (this.$pi.lang.isArray(value)) {
170
+ if (this.$pi.lang.isArray(val)) {
170
171
  return console.error('手风琴模式下,pi-collapse组件的value参数不能为数组')
171
172
  }
172
- this.expanded = this.name == value
173
+ this.expanded = this.name == val
173
174
  } else {
174
- if (!this.$pi.lang.isArray(value) && value !== null) {
175
+ if (!this.$pi.lang.isArray(val) && val !== null) {
175
176
  return console.error('非手风琴模式下,pi-collapse组件的value参数必须为数组')
176
177
  }
177
- this.expanded = (value || []).some(item => item == this.name)
178
+ this.expanded = (val || []).some(item => item == this.name)
178
179
  }
179
180
  // 设置组件的展开或收起状态
180
181
  this.$nextTick(function() {
@@ -339,7 +340,7 @@ export default {
339
340
  }
340
341
  &__content {
341
342
  overflow: hidden;
342
- height: 0;
343
+ height: auto;
343
344
 
344
345
  &__text {
345
346
  padding: 24rpx 30rpx;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta38",
3
+ "version": "1.2.7beta39",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {