更新记录
1.0.0(2023-03-22) 下载此版本
初始化,支持单选
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | - | - | - | - | - |
jiangcs-tree-picker
使用方法
template中定义组件
<jiangcs-tree-picker ref="treePicker" :dataArr="dataArr" @select="selectOrg"></jiangcs-tree-picker>
节点数组
dataArr: [{
id: 1,
title: '公司',
pid: 0,
expand: true,
children: [{
id: 11,
title: '研发部',
pid: 2,
expand: false,
children: [{
id: 111,
title: '研发部-1部',
pid: 3,
expand: false
}]
}, {
id: 12,
title: '综合部',
pid: 1,
expand: false
}]
}]
js定义select方法
selectOrg(type, node) {
if (type === 'confirm') {
// 业务逻辑
}
}
js打开弹框
this.$refs.treePicker.open();
store支持
- 定义tree.js
export default {
namespaced: true,
state: {
node: {
id: 0,
name: ''
}
},
mutations: {
updateNode(state, node) {
state.node = node;
}
},
actions: {
// 更新节点
updateNode({
commit
}, node) {
commit('updateNode', node);
}
}
}