ct-component-plus 0.0.23 → 0.0.24

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.23",
4
+ "version": "0.0.24",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -6,17 +6,10 @@
6
6
  </template>
7
7
 
8
8
  <script setup>
9
- import { reactive, onMounted, inject, watch, unref } from "vue";
9
+ import { inject, unref } from "vue";
10
10
  const downloadLoading = inject("downloadLoading", false);
11
- watch(
12
- () => downloadLoading,
13
- (val) => {
14
- console.log("watch", val);
15
- }
16
- );
17
11
  const emit = defineEmits(["download"]);
18
12
  const download = () => {
19
- console.log("download", unref(downloadLoading));
20
13
  if (unref(downloadLoading)) return;
21
14
  emit("download");
22
15
  };
@@ -21,6 +21,7 @@
21
21
  :class="[ns.e('handle-item'), ns.is(item, true)]"
22
22
  v-for="(item, index) in handleList"
23
23
  :key="index"
24
+ v-show="handleItemShow(item)"
24
25
  >
25
26
  <component
26
27
  v-if="handleItemShow(item)"
@@ -7,6 +7,7 @@ import {
7
7
  computed,
8
8
  resolveComponent,
9
9
  provide,
10
+ nextTick,
10
11
  } from "vue";
11
12
  import { useNamespace } from "../../../hooks";
12
13
  import SearchBox from "../../search-box";
@@ -22,6 +23,10 @@ export default {
22
23
  type: String,
23
24
  default: "",
24
25
  },
26
+ needInit: {
27
+ type: Boolean,
28
+ default: true,
29
+ },
25
30
  searchConfig: {
26
31
  type: Object,
27
32
  default: () => {
@@ -100,7 +105,6 @@ export default {
100
105
  // searchBox逻辑
101
106
  const searchRef = ref(null);
102
107
  const doSearch = (params) => {
103
- console.log("doSearch", params);
104
108
  state.searchParams = params;
105
109
  state.pageNo = 1;
106
110
  getPageData();
@@ -177,7 +181,6 @@ export default {
177
181
  getPageData();
178
182
  };
179
183
  const changePageNo = (val) => {
180
- console.log("changePageNo", val);
181
184
  state.pageNo = val;
182
185
  getPageData();
183
186
  };
@@ -193,7 +196,18 @@ export default {
193
196
  });
194
197
  downloadLoading.value = false;
195
198
  };
196
-
199
+ const clickSearch = () => {
200
+ if (searchRef.value && isFunction(searchRef.value.doSearch)) {
201
+ searchRef.value.doSearch();
202
+ } else {
203
+ doSearch({});
204
+ }
205
+ };
206
+ if (props.needInit) {
207
+ nextTick(() => {
208
+ clickSearch();
209
+ });
210
+ }
197
211
  const ns = useNamespace("page-component");
198
212
  expose({
199
213
  searchMethod,
@@ -202,6 +216,7 @@ export default {
202
216
  tableRef,
203
217
  paginationRef,
204
218
  doSearch,
219
+ clickSearch,
205
220
  getPageData,
206
221
  changePageNo,
207
222
  changeSort,
@@ -169,6 +169,7 @@ defineExpose({
169
169
  componentAll: componentAll.value,
170
170
  getComponent,
171
171
  buriedParams,
172
+ doSearch,
172
173
  });
173
174
  onMounted(() => {});
174
175
  </script>
@@ -1,17 +1,22 @@
1
1
  <template>
2
2
  <div :class="[ns.b()]">
3
3
  <div :class="[ns.e('container')]">
4
- <el-table ref="tableRef"
4
+ <el-table
5
+ ref="tableRef"
5
6
  :class="[ns.e('body')]"
6
7
  :data="showData"
7
8
  :span-method="spanMethod"
8
9
  @selection-change="handleSelectChange"
9
- row-key="rowKey" v-bind="$attrs">
10
+ row-key="rowKey"
11
+ v-bind="$attrs"
12
+ >
10
13
  <el-table-column
11
14
  v-if="isMultiSelect"
12
- type="selection" width="88"
15
+ type="selection"
16
+ width="88"
13
17
  v-bind="multiSelectAttr"
14
- :reserve-selection="true"></el-table-column>
18
+ :reserve-selection="true"
19
+ ></el-table-column>
15
20
  <el-table-column
16
21
  v-for="(column, index) in columnData"
17
22
  :key="column.value + '-' + column.label"
@@ -24,25 +29,26 @@
24
29
  :align="column.align || 'center'"
25
30
  :fixed="column.fixed || false"
26
31
  show-overflow-tooltip
27
- v-bind="column.rawAttr || {}">
28
- <template #header="scope"
29
- v-if="column.slotHeader">
32
+ v-bind="column.rawAttr || {}"
33
+ >
34
+ <template #header="scope" v-if="column.slotHeader">
30
35
  <slot
31
36
  :name="column.value + 'Header'"
32
37
  v-bind="scope"
33
38
  :column="column"
34
39
  :label="column.label"
35
- :value="column.value">
40
+ :value="column.value"
41
+ >
36
42
  </slot>
37
43
  </template>
38
44
  <template #default="scope">
39
- <slot :name="column.value"
45
+ <slot
46
+ :name="column.value"
40
47
  :value="scope.row[column.value]"
41
48
  v-bind="scope"
42
- :column="column">
43
- <span>{{
44
- scope.row[column.value]
45
- }}</span>
49
+ :column="column"
50
+ >
51
+ <span>{{ scope.row[column.value] }}</span>
46
52
  </slot>
47
53
  <el-table-column
48
54
  v-for="(column1, index) in column.children"
@@ -56,16 +62,16 @@
56
62
  :align="column1.align || 'center'"
57
63
  :fixed="column1.fixed || false"
58
64
  show-overflow-tooltip
59
- v-bind="column1.rawAttr || {}">
65
+ v-bind="column1.rawAttr || {}"
66
+ >
60
67
  <template #default="scope">
61
68
  <slot
62
69
  :name="column1.value"
63
70
  :value="scope.row[column1.value]"
64
71
  v-bind="scope"
65
- :column="column1">
66
- <span>{{
67
- scope.row[column1.value]
68
- }}</span>
72
+ :column="column1"
73
+ >
74
+ <span>{{ scope.row[column1.value] }}</span>
69
75
  </slot>
70
76
  </template>
71
77
  </el-table-column>
@@ -73,12 +79,13 @@
73
79
  </el-table-column>
74
80
  <template #empty>
75
81
  <slot name="empty">
76
- <component :is="tableEmptyDom"
82
+ <component
83
+ :is="tableEmptyDom"
77
84
  v-if="tableEmptyDom"
78
- :text="emptyText">
85
+ :text="emptyText"
86
+ >
79
87
  </component>
80
- <span v-else>{{ emptyText
81
- }}</span>
88
+ <span v-else>{{ emptyText }}</span>
82
89
  </slot>
83
90
  </template>
84
91
  </el-table>
@@ -88,13 +95,11 @@
88
95
  :total="total"
89
96
  :current-page="pageNo"
90
97
  v-if="pageSize"
91
- @current-change="handleCurrentChange"></ct-pagination>
98
+ @current-change="handleCurrentChange"
99
+ ></ct-pagination>
92
100
  </div>
93
- <Teleport :to="`#${teleportDom}`"
94
- v-if="teleportDom && teleportStatus">
95
- <table-sort
96
- v-model:sort-obj="sortObj"
97
- :sort-list="sortList"></table-sort>
101
+ <Teleport :to="`#${teleportDom}`" v-if="teleportDom && teleportStatus">
102
+ <table-sort v-model:sort-obj="sortObj" :sort-list="sortList"></table-sort>
98
103
  </Teleport>
99
104
  </div>
100
105
  </template>
@@ -243,7 +248,6 @@ const sortList = computed(() => {
243
248
  });
244
249
  onMounted(() => {
245
250
  teleportStatus.value = true; //直到dom挂载完毕再挂载teleport组件
246
- console.log(props.teleportDom);
247
251
  });
248
252
 
249
253
  defineExpose({ tableRef });