haiwei-ui 1.4.0 → 1.4.2
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
|
@@ -56,27 +56,14 @@
|
|
|
56
56
|
methods: {
|
|
57
57
|
refresh() {
|
|
58
58
|
this.loading = true
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.loading = false
|
|
68
|
-
})
|
|
69
|
-
} else {
|
|
70
|
-
// 非枚举组件,使用原来的action方法
|
|
71
|
-
this.action()
|
|
72
|
-
.then(options => {
|
|
73
|
-
this.options = options
|
|
74
|
-
this.loading = false
|
|
75
|
-
})
|
|
76
|
-
.catch(() => {
|
|
77
|
-
this.loading = false
|
|
78
|
-
})
|
|
79
|
-
}
|
|
59
|
+
this.action()
|
|
60
|
+
.then(options => {
|
|
61
|
+
this.options = options
|
|
62
|
+
this.loading = false
|
|
63
|
+
})
|
|
64
|
+
.catch(() => {
|
|
65
|
+
this.loading = false
|
|
66
|
+
})
|
|
80
67
|
},
|
|
81
68
|
// 清楚已选项
|
|
82
69
|
clear() {
|
|
@@ -44,33 +44,17 @@
|
|
|
44
44
|
methods: {
|
|
45
45
|
refresh() {
|
|
46
46
|
this.loading = true
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.loading = false
|
|
59
|
-
})
|
|
60
|
-
} else {
|
|
61
|
-
// 非枚举组件,使用原来的action方法
|
|
62
|
-
this.action()
|
|
63
|
-
.then(data => {
|
|
64
|
-
this.options = data
|
|
65
|
-
if (data.length > 0 && this.checkedFirst) {
|
|
66
|
-
this.onChange(data[0].value)
|
|
67
|
-
}
|
|
68
|
-
this.loading = false
|
|
69
|
-
})
|
|
70
|
-
.catch(() => {
|
|
71
|
-
this.loading = false
|
|
72
|
-
})
|
|
73
|
-
}
|
|
47
|
+
this.action()
|
|
48
|
+
.then(data => {
|
|
49
|
+
this.options = data
|
|
50
|
+
if (data.length > 0 && this.checkedFirst) {
|
|
51
|
+
this.onChange(data[0].value)
|
|
52
|
+
}
|
|
53
|
+
this.loading = false
|
|
54
|
+
})
|
|
55
|
+
.catch(() => {
|
|
56
|
+
this.loading = false
|
|
57
|
+
})
|
|
74
58
|
},
|
|
75
59
|
onChange(val) {
|
|
76
60
|
this.value_ = val
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import loading from './loading'
|
|
2
|
+
|
|
1
3
|
export default {
|
|
4
|
+
mixins: [loading],
|
|
2
5
|
data() {
|
|
3
6
|
return {
|
|
4
7
|
//初始值
|
|
@@ -100,54 +103,25 @@ export default {
|
|
|
100
103
|
if (this.filterable && this.remote) return
|
|
101
104
|
|
|
102
105
|
this.loading = true
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.getEnumData(this.moduleCode, this.enumName, this.libName)
|
|
107
|
-
.then(options => {
|
|
108
|
-
this.options = options
|
|
109
|
-
this.loading = false
|
|
110
|
-
|
|
111
|
-
// 检查当前值是否在新加载的选项中
|
|
112
|
-
if (this.value_ && options.length > 0) {
|
|
113
|
-
const found = this.findOptionByValue(this.value_)
|
|
114
|
-
if (found) {
|
|
115
|
-
console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
|
|
116
|
-
} else {
|
|
117
|
-
console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (this.checkedFirst && !this.hasInit && options.length > 0) {
|
|
122
|
-
this.onChange(options[0].value)
|
|
123
|
-
this.hasInit = true
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
.catch(() => {
|
|
127
|
-
this.loading = false
|
|
128
|
-
})
|
|
129
|
-
} else {
|
|
130
|
-
// 非枚举组件,使用原来的action方法
|
|
131
|
-
this.action().then(options => {
|
|
132
|
-
this.options = options
|
|
133
|
-
this.loading = false
|
|
106
|
+
this.action().then(options => {
|
|
107
|
+
this.options = options
|
|
108
|
+
this.loading = false
|
|
134
109
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
110
|
+
// 检查当前值是否在新加载的选项中
|
|
111
|
+
if (this.value_ && options.length > 0) {
|
|
112
|
+
const found = this.findOptionByValue(this.value_)
|
|
113
|
+
if (found) {
|
|
114
|
+
console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
|
|
115
|
+
} else {
|
|
116
|
+
console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
|
|
143
117
|
}
|
|
118
|
+
}
|
|
144
119
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
120
|
+
if (this.checkedFirst && !this.hasInit && options.length > 0) {
|
|
121
|
+
this.onChange(options[0].value)
|
|
122
|
+
this.hasInit = true
|
|
123
|
+
}
|
|
124
|
+
})
|
|
151
125
|
},
|
|
152
126
|
// 根据值查找选项
|
|
153
127
|
findOptionByValue(value) {
|
|
@@ -34,27 +34,14 @@ export default {
|
|
|
34
34
|
methods: {
|
|
35
35
|
refresh() {
|
|
36
36
|
this.loading = true
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.loading = false
|
|
46
|
-
})
|
|
47
|
-
} else {
|
|
48
|
-
// 非枚举组件,使用原来的action方法
|
|
49
|
-
this.action()
|
|
50
|
-
.then(options => {
|
|
51
|
-
this.options = options
|
|
52
|
-
this.loading = false
|
|
53
|
-
})
|
|
54
|
-
.catch(() => {
|
|
55
|
-
this.loading = false
|
|
56
|
-
})
|
|
57
|
-
}
|
|
37
|
+
this.action()
|
|
38
|
+
.then(options => {
|
|
39
|
+
this.options = options
|
|
40
|
+
this.loading = false
|
|
41
|
+
})
|
|
42
|
+
.catch(() => {
|
|
43
|
+
this.loading = false
|
|
44
|
+
})
|
|
58
45
|
},
|
|
59
46
|
getLabelByValue(value) {
|
|
60
47
|
if (!value || !this.options.length) return value
|