mali-applet-ui 0.1.24 → 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.
@@ -107,16 +107,20 @@ export default {
107
107
  return this.load()
108
108
  },
109
109
  async load() {
110
- uni.showLoading({
111
- title: '加载中'
112
- })
110
+ if (this.$loading) {
111
+ this.$loading.show()
112
+ }
113
113
  try {
114
114
  const data = await this.getList()
115
- uni.hideLoading()
115
+ if (this.$loading) {
116
+ this.$loading.hide()
117
+ }
116
118
  uni.stopPullDownRefresh()
117
119
  this.$emit('input', data)
118
120
  } catch (e) {
119
- uni.hideLoading()
121
+ if (this.$loading) {
122
+ this.$loading.hide()
123
+ }
120
124
  uni.stopPullDownRefresh()
121
125
  console.error(e)
122
126
  }
@@ -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;
@@ -181,9 +181,9 @@ export default {
181
181
  },
182
182
  async selectFile (e) {
183
183
  const { tempFiles } = e
184
- uni.showLoading({
185
- title: "上传中..."
186
- });
184
+ if (this.$loading) {
185
+ this.$loading.show('上传中')
186
+ }
187
187
  const uploadMethod = this.uploadFile ? this.uploadFile : (globalStore.upload ? globalStore.upload.uploadFile : null)
188
188
  Promise.all(
189
189
  tempFiles.map(file => {
@@ -220,10 +220,13 @@ export default {
220
220
  }
221
221
  })
222
222
  ).then(res => {
223
- uni.hideLoading();
223
+ if (this.$loading) {
224
+ this.$loading.hide()
225
+ }
224
226
  }).catch((e) => {
225
- console.error(e)
226
- uni.hideLoading();
227
+ if (this.$loading) {
228
+ this.$loading.hide()
229
+ }
227
230
  })
228
231
  },
229
232
  removeEvent (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",