@bsgoal/common 2.12.0 → 2.12.1
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/dist/index.mjs +670 -666
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/bsgoal-base-tree/demo.vue +13 -2
- package/src/components/bsgoal-base-tree/index.vue +13 -6
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-21 08:43:39
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-21
|
|
5
|
+
* @LastEditTime: 2023-06-21 17:57:30
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree\demo.vue
|
|
7
7
|
* @Description: 左侧树的演示
|
|
8
8
|
*
|
|
@@ -59,7 +59,7 @@ const treeLazyLoad = (node) => {
|
|
|
59
59
|
{
|
|
60
60
|
label: 'label2-1',
|
|
61
61
|
isLeaf: true,
|
|
62
|
-
hasIcon:true
|
|
62
|
+
hasIcon: true
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
label: 'label2-2',
|
|
@@ -100,6 +100,17 @@ const triggerAddClick = (params = '') => {
|
|
|
100
100
|
<div class="bsgoal-base-tree-demo">
|
|
101
101
|
<div class="base_tree_demo">
|
|
102
102
|
<BsgoalBaseTree
|
|
103
|
+
:data="[
|
|
104
|
+
{
|
|
105
|
+
value: 'value999',
|
|
106
|
+
label: 'label999',
|
|
107
|
+
children: [
|
|
108
|
+
{
|
|
109
|
+
label: '8888'
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
]"
|
|
103
114
|
:lazy-load="treeLazyLoad"
|
|
104
115
|
:init-node="treeInitNode"
|
|
105
116
|
@on-click="triggerTreeClick"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-21 08:43:33
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-21
|
|
5
|
+
* @LastEditTime: 2023-06-21 17:57:59
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree\index.vue
|
|
7
7
|
* @Description: 虚拟化树型结构 公共组件
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script setup>
|
|
11
11
|
/* setup模板
|
|
12
12
|
---------------------------------------------------------------- */
|
|
13
|
-
import { ref, watch, watchEffect } from 'vue'
|
|
13
|
+
import { ref, watch, watchEffect, computed } from 'vue'
|
|
14
14
|
import directiveBase from '../../directives/directiveBase.js'
|
|
15
15
|
import BsgoalBaseLine from '../bsgoal-base-line/index.vue'
|
|
16
16
|
import BsgoalBaseTreeFold from '../bsgoal-base-tree-fold/index.vue'
|
|
@@ -122,18 +122,24 @@ watch(foldStatus, () => {
|
|
|
122
122
|
* @return {*}
|
|
123
123
|
*/
|
|
124
124
|
const loadNode = async (node, resolve, props) => {
|
|
125
|
-
// console.log('props',props);
|
|
126
125
|
if (node.level === 0) {
|
|
127
126
|
const initNodeData = await props.initNode(node)
|
|
128
|
-
// console.log('initNodeData',initNodeData);
|
|
129
127
|
return resolve(initNodeData || [])
|
|
130
128
|
} else {
|
|
131
129
|
const lazyNodeData = await props.lazyLoad(node)
|
|
132
|
-
// console.log('lazyNodeData',lazyNodeData);
|
|
133
130
|
resolve(lazyNodeData || [])
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
133
|
|
|
134
|
+
const lazyGet = computed(() => {
|
|
135
|
+
const { data = [] } = props
|
|
136
|
+
if (!data || !data.length) {
|
|
137
|
+
return true
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return false
|
|
141
|
+
})
|
|
142
|
+
|
|
137
143
|
/**
|
|
138
144
|
* @Author: canlong.shen
|
|
139
145
|
* @description: 点击加号图标触发事件
|
|
@@ -156,9 +162,10 @@ const handleItemAdd = (node = null, data = {}) => {
|
|
|
156
162
|
<!-- S 树结构 -->
|
|
157
163
|
<el-tree
|
|
158
164
|
ref="EL_TREE_REF"
|
|
159
|
-
lazy
|
|
160
165
|
highlight-current
|
|
161
166
|
empty-text="暂无数据"
|
|
167
|
+
:data="data"
|
|
168
|
+
:lazy="lazyGet"
|
|
162
169
|
:load="(node, resolve) => loadNode(node, resolve, props)"
|
|
163
170
|
:expand-on-click-node="false"
|
|
164
171
|
:props="treeProps"
|