mali-applet-ui 0.1.25 → 0.1.26

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.
@@ -2,13 +2,13 @@
2
2
  <view v-if="isFromReadonly" class="ml-province-city-picker is-readonly">
3
3
  <view class="ml-province-city-picker-readonly-content">{{ selectLabel }}</view>
4
4
  </view>
5
- <view v-else class="ml-province-city-picker" :class="[className || '', {'is-border': border, 'is-clear': value !== null}]">
5
+ <view v-else class="ml-province-city-picker" :class="[className || '', {'is-border': border, 'is-clear': (value ? (value.length || province) : province)}]">
6
6
  <view class="ml-province-city-picker-warpper" @click="openPopup()">
7
7
  <view class="ml-province-city-picker-text">
8
- <text v-if="value !== null">{{ selectLabel }}</text>
8
+ <text v-if="(value ? (value.length || province) : province)">{{ selectLabel }}</text>
9
9
  <text v-else class="picker-placeholder">{{ placeholder }}</text>
10
10
  </view>
11
- <view v-if="clearable && value !== null" class="ml-province-city-picker-clear-icon" @click.stop="clearEvent">
11
+ <view v-if="clearable && (value ? (value.length || province) : province)" class="ml-province-city-picker-clear-icon" @click.stop="clearEvent">
12
12
  <ml-icon name="delete-filling"></ml-icon>
13
13
  </view>
14
14
  <view v-else class="ml-province-city-picker-icon">
@@ -77,7 +77,10 @@ export default {
77
77
  const provinceItem = this.provinceList.find(item => item[this.optValueField] === province)
78
78
  const cityItem = provinceItem && provinceItem.children? provinceItem.children.find(item => item[this.optValueField] === city) : null
79
79
  if (provinceItem) {
80
- return [provinceItem ? provinceItem[this.optLabelField] : '', cityItem ? cityItem[this.optLabelField] : ''].join(' / ')
80
+ if (cityItem) {
81
+ return [provinceItem[this.optLabelField] || '', cityItem[this.optLabelField] || ''].join(' / ')
82
+ }
83
+ return provinceItem[this.optLabelField] || ''
81
84
  }
82
85
  return ''
83
86
  },
@@ -122,6 +125,16 @@ export default {
122
125
  changeEvent (e) {
123
126
  this.selectVals = e.detail.value
124
127
  },
128
+ clearEvent () {
129
+ const value = ['', '']
130
+ this.selectVals = [0]
131
+ this.$emit('update:province', value[0])
132
+ this.$emit('update:city', value[1])
133
+ this.$emit('input', value)
134
+ this.$emit('change', { value })
135
+ this.$emit('clear', { value })
136
+ this.closePopup()
137
+ },
125
138
  confirmEvent () {
126
139
  const value = [this.selectProvinceValue, this.selectCityValue]
127
140
  this.$emit('update:province', value[0])
@@ -171,7 +184,7 @@ export default {
171
184
  border-radius: 0 10rpx 10rpx 0;
172
185
  }
173
186
  .ml-province-city-picker-icon {
174
- width: 60rpx;
187
+ width: 34rpx;
175
188
  display: flex;
176
189
  flex-shrink: 0;
177
190
  align-items: center;
@@ -139,7 +139,7 @@ export default {
139
139
  white-space: nowrap;
140
140
  }
141
141
  .ml-select-picker-clear-icon {
142
- width: 60rpx;
142
+ width: 34rpx;
143
143
  display: flex;
144
144
  flex-shrink: 0;
145
145
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",