qtsk-vue3 0.0.47 → 0.0.49

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.
@@ -2,7 +2,8 @@
2
2
  <el-tree
3
3
  ref="treeRef"
4
4
  style="max-width: 600px;padding-top: 4px;"
5
- :data="data"
5
+ :data="data"
6
+ v-bind="$attrs"
6
7
  :props="defaultProps"
7
8
  :show-checkbox="showCheckBox"
8
9
  default-expand-all
@@ -65,16 +66,18 @@ const props = defineProps({
65
66
  type: Object,
66
67
  default: () => ({
67
68
  children: 'children',
68
- label: 'name'
69
+ label: 'name',
70
+ indeterminate: 'indeterminate'
69
71
  })
70
- }
72
+ },
73
+ type: String
71
74
  })
72
75
 
73
76
  const emits = defineEmits(['handleTree', 'handleNode'])
74
77
  // 点击节点
75
78
  const handleNodeClick = (data) => {
76
79
  console.log('data', data)
77
- emits('handleNode', data)
80
+ emits('handleNode', data, props.type)
78
81
  }
79
82
 
80
83
  // 获取选中的节点
@@ -84,11 +87,26 @@ const getCheckedKeys = () => {
84
87
 
85
88
  //当复选框被点击的时候触发, 用于获取所有的选中数据
86
89
  const checkChange = () => {
90
+ console.log('treeRef.value.getCheckedKeys()', treeRef.value.getCheckedKeys())
87
91
  // modelValue.value = treeRef.value.getCheckedKeys()
88
92
  }
89
93
  const handleCheck = (currentNode, {checkedKeys}) => {
90
94
  console.log('currentNode', currentNode)
95
+ console.log('checkedKeys', checkedKeys)
96
+ modelValue.value = checkedKeys
97
+ // treeRef.value.setCheckedKeys(checkedKeys)
98
+ /* const values = modelValue.value
91
99
  let keys = []
100
+ if (checkedKeys.length) {
101
+ // 选中时,将当前节点设为唯一选中
102
+ keys = [currentNode[props.nodeKey]];
103
+ } else {
104
+ // 取消选中时,清空所有选中(可选,根据需求决定是否允许取消)
105
+ keys = [];
106
+ }
107
+ modelValue.value = keys */
108
+
109
+ /* let keys = []
92
110
  if (checkedKeys.length) {
93
111
  // 选中时,将当前节点设为唯一选中
94
112
  keys = [currentNode[props.nodeKey]];
@@ -97,13 +115,14 @@ const handleCheck = (currentNode, {checkedKeys}) => {
97
115
  keys = [];
98
116
  }
99
117
  modelValue.value = keys
100
- treeRef.value.setCheckedKeys(keys);
118
+ treeRef.value.setCheckedKeys(keys); */
101
119
  }
102
120
  const handleOperations = (data, type) => {
103
121
  emits('handleTree', data, type)
104
122
  }
105
123
  defineExpose({
106
- getCheckedKeys
124
+ getCheckedKeys,
125
+ getTreeRef: () => treeRef.value
107
126
  })
108
127
  </script>
109
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtsk-vue3",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "vue3版组件库",
5
5
  "main": "./package/index.js",
6
6
  "scripts": {