haiwei-ui 1.4.1 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haiwei-ui",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "HaiWei前端组件库",
5
5
  "author": "Eric",
6
6
  "license": "ISC",
@@ -56,27 +56,14 @@
56
56
  methods: {
57
57
  refresh() {
58
58
  this.loading = true
59
- // 如果是枚举组件,使用缓存方法
60
- if (this.moduleCode && this.enumName) {
61
- this.getEnumData(this.moduleCode, this.enumName, this.libName)
62
- .then(options => {
63
- this.options = options
64
- this.loading = false
65
- })
66
- .catch(() => {
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
- if (this.moduleCode && this.enumName) {
49
- this.getEnumData(this.moduleCode, this.enumName, this.libName)
50
- .then(data => {
51
- this.options = data
52
- if (data.length > 0 && this.checkedFirst) {
53
- this.onChange(data[0].value)
54
- }
55
- this.loading = false
56
- })
57
- .catch(() => {
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
@@ -103,54 +103,25 @@ export default {
103
103
  if (this.filterable && this.remote) return
104
104
 
105
105
  this.loading = true
106
-
107
- // 如果是枚举组件,使用缓存方法
108
- if (this.moduleCode && this.enumName) {
109
- this.getEnumData(this.moduleCode, this.enumName, this.libName)
110
- .then(options => {
111
- this.options = options
112
- this.loading = false
113
-
114
- // 检查当前值是否在新加载的选项中
115
- if (this.value_ && options.length > 0) {
116
- const found = this.findOptionByValue(this.value_)
117
- if (found) {
118
- console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
119
- } else {
120
- console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
121
- }
122
- }
106
+ this.action().then(options => {
107
+ this.options = options
108
+ this.loading = false
123
109
 
124
- if (this.checkedFirst && !this.hasInit && options.length > 0) {
125
- this.onChange(options[0].value)
126
- this.hasInit = true
127
- }
128
- })
129
- .catch(() => {
130
- this.loading = false
131
- })
132
- } else {
133
- // 非枚举组件,使用原来的action方法
134
- this.action().then(options => {
135
- this.options = options
136
- this.loading = false
137
-
138
- // 检查当前值是否在新加载的选项中
139
- if (this.value_ && options.length > 0) {
140
- const found = this.findOptionByValue(this.value_)
141
- if (found) {
142
- console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
143
- } else {
144
- console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
145
- }
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_)
146
117
  }
118
+ }
147
119
 
148
- if (this.checkedFirst && !this.hasInit && options.length > 0) {
149
- this.onChange(options[0].value)
150
- this.hasInit = true
151
- }
152
- })
153
- }
120
+ if (this.checkedFirst && !this.hasInit && options.length > 0) {
121
+ this.onChange(options[0].value)
122
+ this.hasInit = true
123
+ }
124
+ })
154
125
  },
155
126
  // 根据值查找选项
156
127
  findOptionByValue(value) {
@@ -34,27 +34,14 @@ export default {
34
34
  methods: {
35
35
  refresh() {
36
36
  this.loading = true
37
- // 如果是枚举组件,使用缓存方法
38
- if (this.moduleCode && this.enumName) {
39
- this.getEnumData(this.moduleCode, this.enumName, this.libName)
40
- .then(options => {
41
- this.options = options
42
- this.loading = false
43
- })
44
- .catch(() => {
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