当前位置:网站首页>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 |
边栏推荐
猜你喜欢

Talking from mlperf: how to lead the next wave of AI accelerator

Linux closes the redis process SYSTEMd+

DHT11 温湿度传感器

Index method and random forest to realize the information of surface water body in wet season in Shandong Province

One of the characteristic agricultural products that make Tiantou village, Guankou Town, Xiamen into a "sweet" village is

相同区域 多源栅格数据 各个像元行列号一致,即行数列数相同,像元大小相同

可动的机械挂钟

Excel dynamic chart

3D打印机穿线:5种简单的解决方案

Primary application case of Excel DuPont analyzer
随机推荐
UOW of dev XPO comparison
Arcserver password reset (account cannot be reset)
SystemVerilog学习-06-类的封装
srpingboot security demo
Talking from mlperf: how to lead the next wave of AI accelerator
Oracle create user + Role
OpenGL es: (3) EGL, basic steps of EGL drawing, eglsurface, anativewindow
highmap gejson数据格式转换脚本
Kubedm builds kubenetes cluster (Personal Learning version)
linux 关闭redis 进程 systemd+
DHT11 temperature and humidity sensor
地宫取宝(记忆化深搜)
栈题目:解析布尔表达式
Database problems, how to optimize Oracle SQL query statements faster and more efficient
JDBC database operation
【网络安全工具】USB控制软件有什么用
excel初级应用案例——杜邦分析仪
[note] e-commerce order data analysis practice
excel動態圖錶
【ManageEngine卓豪】网络运维管理是什么,网络运维平台有什么用