haiwei-ui 1.3.0 → 1.3.1
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.
package/package.json
CHANGED
|
@@ -104,6 +104,16 @@ export default {
|
|
|
104
104
|
this.options = options
|
|
105
105
|
this.loading = false
|
|
106
106
|
|
|
107
|
+
// 检查当前值是否在新加载的选项中
|
|
108
|
+
if (this.value_ && options.length > 0) {
|
|
109
|
+
const found = this.findOptionByValue(this.value_)
|
|
110
|
+
if (found) {
|
|
111
|
+
console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
|
|
112
|
+
} else {
|
|
113
|
+
console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
107
117
|
if (this.checkedFirst && !this.hasInit && options.length > 0) {
|
|
108
118
|
this.onChange(options[0].value)
|
|
109
119
|
this.hasInit = true
|
|
@@ -183,15 +193,21 @@ export default {
|
|
|
183
193
|
console.log('【nm-select】value 变化:', oldVal, '->', newVal)
|
|
184
194
|
this.value_ = newVal
|
|
185
195
|
|
|
186
|
-
//
|
|
187
|
-
if (newVal
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
// 如果新值不为空,检查新值是否在选项中
|
|
197
|
+
if (newVal) {
|
|
198
|
+
// 如果选项数据已加载,立即检查
|
|
199
|
+
if (this.options.length > 0) {
|
|
200
|
+
const found = this.findOptionByValue(newVal)
|
|
201
|
+
if (!found) {
|
|
202
|
+
console.warn('【nm-select】值', newVal, '不在当前选项列表中,尝试重新加载选项数据')
|
|
203
|
+
// 值不在当前选项中,重新加载选项数据
|
|
204
|
+
this.refresh()
|
|
205
|
+
} else {
|
|
206
|
+
console.log('【nm-select】找到匹配选项:', found.label, '->', found.value)
|
|
207
|
+
}
|
|
193
208
|
} else {
|
|
194
|
-
console.log('【nm-select
|
|
209
|
+
console.log('【nm-select】选项数据尚未加载,等待refresh后检查')
|
|
210
|
+
// 选项数据尚未加载,将在refresh方法中检查
|
|
195
211
|
}
|
|
196
212
|
}
|
|
197
213
|
}
|