ct-component-plus 0.0.24 → 0.0.25

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,7 +1,7 @@
1
1
  {
2
2
  "name": "ct-component-plus",
3
3
  "private": false,
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -138,6 +138,9 @@ const emptyText = computed(() => {
138
138
  ? props.noMatchText || "暂无匹配数据"
139
139
  : props.noDataText || "暂无数据";
140
140
  });
141
+ const getUseLabel = (label) => {
142
+ return typeof label === "string" ? label : String(label);
143
+ };
141
144
 
142
145
  watch(
143
146
  () => selectText.value,
@@ -170,7 +173,7 @@ watchEffect(async () => {
170
173
  noFilterOptions.value = true;
171
174
  }
172
175
  });
173
- watchEffect(async () => {
176
+ const watchServiceHandle = async () => {
174
177
  // 通过api获取数据,会监听api以及serviceParams的改变(收集到的依赖改变)都会触发重新查询
175
178
  const cbs = props.cbs || {};
176
179
  if (props.api && baseDao) {
@@ -194,11 +197,11 @@ watchEffect(async () => {
194
197
  }
195
198
  data = data.map((item) => {
196
199
  if (self) {
197
- return { label: item, value: item };
200
+ return { label: getUseLabel(item), value: item };
198
201
  }
199
202
  return {
200
203
  ...item,
201
- label: item[label],
204
+ label: getUseLabel(item[label]),
202
205
  value: item[value],
203
206
  };
204
207
  });
@@ -221,7 +224,21 @@ watchEffect(async () => {
221
224
  }
222
225
  } catch (error) {}
223
226
  }
224
- });
227
+ };
228
+ watch(
229
+ [
230
+ () => props.api,
231
+ () => props.serviceParams,
232
+ () => props.serviceMethod,
233
+ () => props.mapObj,
234
+ ],
235
+ (newVal, oldVal) => {
236
+ watchServiceHandle();
237
+ },
238
+ {
239
+ immediate: true,
240
+ }
241
+ );
225
242
  const checkedAll = useCheckedAll(filterOptions, valueModel, {
226
243
  onCheckedAll: (falg) => {
227
244
  if (!keyword.value && !falg) {