sadais-piui 1.2.7-beta38 → 1.2.7-beta40

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
  }
@@ -114,7 +114,7 @@ export default {
114
114
  // uni.createAnimation的导出数据
115
115
  animationData: {},
116
116
  // 是否展开状态
117
- expanded: false,
117
+ expanded: true,
118
118
  // 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
119
119
  showBorder: false,
120
120
  // 是否动画中,如果是则不允许继续触发点击
@@ -164,22 +164,23 @@ 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
168
  if (accordion) {
169
- if (this.$pi.lang.isArray(value)) {
169
+ if (this.$pi.lang.isArray(val)) {
170
170
  return console.error('手风琴模式下,pi-collapse组件的value参数不能为数组')
171
171
  }
172
- this.expanded = this.name == value
172
+ this.expanded = this.name == val
173
173
  } else {
174
- if (!this.$pi.lang.isArray(value) && value !== null) {
174
+ if (!this.$pi.lang.isArray(val) && val !== null) {
175
175
  return console.error('非手风琴模式下,pi-collapse组件的value参数必须为数组')
176
176
  }
177
- this.expanded = (value || []).some(item => item == this.name)
177
+ this.expanded = (val || []).some(item => item == this.name)
178
178
  }
179
+ console.log('折叠面板item初始化', val, accordion, this.expanded)
179
180
  // 设置组件的展开或收起状态
180
- this.$nextTick(function() {
181
+ setTimeout(() => {
181
182
  this.setContentAnimate()
182
- })
183
+ }, 200)
183
184
  },
184
185
  updateParentData() {
185
186
  // 传组件Name给父组件,用于组件展开或收起时,改变父组件的值
@@ -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;
@@ -273,17 +273,21 @@ export default {
273
273
  watch: {
274
274
  items: {
275
275
  deep: true,
276
- immediate: false,
276
+ immediate: true,
277
277
  handler(value) {
278
278
  this.init()
279
279
  }
280
280
  }
281
281
  },
282
282
  mounted() {
283
- this.init()
283
+ // 防止在某些组件slot里面还没渲染,导致获取不到正确的宽高
284
+ setTimeout(() => {
285
+ this.init()
286
+ }, 200)
284
287
  },
285
288
  methods: {
286
289
  async init() {
290
+ console.log(TAG, '初始化计算步骤条')
287
291
  if (!this.items?.length) return
288
292
  this.iconsRect = await this.$pi.common.queryRect(this, '.step-icon-inner', true)
289
293
  this.itemsRect = await this.$pi.common.queryRect(this, '.pi-steps-item', true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta38",
3
+ "version": "1.2.7beta40",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {