当前位置:网站首页>Uniapp tree level selector
Uniapp tree level selector
2022-07-01 06:14:00 【Three cups and five mountains】
uniapp plug-in unit - Tree level selector
brief introduction
Plug in download address
uniapp Tree level selector plug-in , The use of picker Pop up window , Style and scale reference uniapp Of picker and uni-data-picker Components
- Support single choice 、 multi-select 、 Parent selection
- Support Object Object attribute custom mapping
- Support the display of all selected 、 Partial selection 、 Three states are not selected
- Support quick customization of simple styles ( Split line 、 Button 、 Title, etc. ), Deep styles can be duplicated css
Screenshot display

Usage method
stay script Introduced components in
import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue"
export default {
components: {
baTreePicker
}
stay template Components used in
<ba-tree-picker ref="treePicker" :multiple='false' @select-change="selectChange" title=" Select the city "
:localdata="listData" valueKey="value" textKey="label" childrenKey="children" />
stay script Define the opening method , And selective listening
methods: {
// Show selector
showPicker() {
this.$refs.treePicker._show();
},
// Listen and choose (ids Is an array )
selectChange(ids, names) {
console.log(ids, names)
}
}
stay template Call open
<view @click="showPicker"> Call selector </view>
attribute
| Property name | type | The default value is | explain |
|---|---|---|---|
| localdata | Array | [] | Source data , At present, we support tree structure , In the future, we will consider supporting flat structure |
| valueKey | String | id | Appoint Object in key As node data id |
| textKey | String | name | Appoint Object in key The value of is displayed as a node |
| childrenKey | String | children | Appoint Object in key As a subset of nodes |
| multiple | Boolean | false | Whether to choose more than one , The default radio option is |
| selectParent | Boolean | true | Can I choose a parent , Default OK |
| title | String | title | |
| titleColor | String | Title Color | |
| confirmColor | String | #0055ff | Determine the button color |
| cancelColor | String | #757575 | Cancel button color |
| switchColor | String | #666 | Node switch icon color |
| border | Boolean | false | Whether there is a dividing line , The default is no |
data format
Be careful : There has to be id、name(id It can be done by valueKey To configure other key values , Such as value) Field , And only
[
{
id: 1,
name: ' company 1',
children: [{
id: 11,
name: ' R & D department ',
children: [{
id: 111,
name: ' Zhang San ',
},{
id: 112,
name: ' Li Si ',
}]
},{
id: 12,
name: ' General affairs department ',
} ]
},
{
id: 2,
name: ' company 2',
children: [{
id: 21,
name: ' R & D department ',
},{
id: 22,
name: ' General affairs department ',
},{
id: 23,
name: ' Finance Department ',
}, ]
},
{
id: 3,
name: ' company 3'
},
{
id: 4,
name: ' company 4',
children: [{
id: 41,
name: ' R & D department ',
}]
}
]
Method
| Method name | Parameters | The default value is | explain |
|---|---|---|---|
| _show() | Show selector | ||
| _hide() | Hide selector |
边栏推荐
猜你喜欢

指数法和Random Forest实现山东省丰水期地表水体信息

excel动态图表

ONEFLOW source code parsing: automatic inference of operator signature

Ant new village is one of the special agricultural products that make Tiantou village in Guankou Town, Xiamen become Tiantou village

Timer based on LabVIEW

2022 年面向初学者的 10 大免费 3D 建模软件

FPGA - 7系列 FPGA内部结构之Clocking -02- 时钟布线资源

π disk, turning your computer into a personal private cloud

DHT11 温湿度传感器

Tidb single machine simulation deployment production environment cluster (closed pit practice, personal test is effective)
随机推荐
Flink实战--多流合并
Understanding of C manualresetevent class
栈题目:解析布尔表达式
Flink practice -- multi stream merge
【ManageEngine卓豪】局域网监控的作用
highmap gejson数据格式转换脚本
El tooltip in the table realizes line breaking display
The row and column numbers of each pixel of multi-source grid data in the same area are the same, that is, the number of rows and columns are the same, and the pixel size is the same
C# ManualResetEvent 类的理解
Infinite horizontal marble game
skywalking集成nacos动态配置
Essay learning record essay multi label Global
B-树系列
ArcServer密码重置(账号不可以重置)
SystemVerilog学习-06-类的封装
Small guide for rapid completion of mechanical arm (VI): stepping motor driver
Differences between in and exists in MySQL
3D printer threading: five simple solutions
端口扫描工具对企业有什么帮助?
【ManageEngine卓豪 】助力世界顶尖音乐学院--茱莉亚学院,提升终端安全