ct-component-plus 2.2.12 → 2.2.13
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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -7,6 +7,12 @@ export const selectProps = {
|
|
|
7
7
|
...searchComponentProps,
|
|
8
8
|
modelValue: [String, Number, Array, Boolean],
|
|
9
9
|
multiple: Boolean,
|
|
10
|
+
options: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default() {
|
|
13
|
+
return [];
|
|
14
|
+
},
|
|
15
|
+
},
|
|
10
16
|
filterable: Boolean,
|
|
11
17
|
api: String,
|
|
12
18
|
serviceMethod: String,
|
|
@@ -107,8 +107,23 @@ const attrs = useAttrs();
|
|
|
107
107
|
|
|
108
108
|
const ns = useNamespace("paging-select");
|
|
109
109
|
const optionsByApi = ref([]);
|
|
110
|
+
const extraOptions = computed(() => {
|
|
111
|
+
return props.options && Array.isArray(props.options) ? props.options : [];
|
|
112
|
+
});
|
|
113
|
+
|
|
110
114
|
const showOptions = computed(() => {
|
|
111
|
-
|
|
115
|
+
const map = new Map();
|
|
116
|
+
(extraOptions.value || []).forEach((item) => {
|
|
117
|
+
if (!item || item.value === undefined || item.value === null) return;
|
|
118
|
+
map.set(item.value, item);
|
|
119
|
+
});
|
|
120
|
+
(optionsByApi.value || []).forEach((item) => {
|
|
121
|
+
if (!item || item.value === undefined || item.value === null) return;
|
|
122
|
+
if (!map.has(item.value)) {
|
|
123
|
+
map.set(item.value, item);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return Array.from(map.values());
|
|
112
127
|
});
|
|
113
128
|
const valueModel = computed({
|
|
114
129
|
get() {
|
|
@@ -197,8 +212,8 @@ watch(
|
|
|
197
212
|
selectRef.value.selectedLabel = newVal;
|
|
198
213
|
},
|
|
199
214
|
);
|
|
200
|
-
watch(
|
|
201
|
-
const arr =
|
|
215
|
+
watch(showOptions, () => {
|
|
216
|
+
const arr = showOptions.value || [];
|
|
202
217
|
if (arr.length) {
|
|
203
218
|
filterOptions.value = arr;
|
|
204
219
|
noFilterOptions.value = false;
|