#### 参数说明
| 属性名 |类型| 默认值 | 说明 |
|:------------:|---|:-------:|--------------------------------------|
| range |Array| - | 本地渲染数据 |
| idKey |String| id | 指定 Object 中 key 的值作为单条数据的唯一id |
| nameKey |String| name | 指定 Object 中 key 的值作为选择器显示的内容 |
| allKey |String| value | 指定 Object 中 其他需要返回的内容 |
| title |String| - | 选择器的名称默认为空 |
| titleColor |String| #757575 | 标题的颜色 |
| confirmColor |String| #007aff | 确定按钮及选择框的颜色 |
| cancelColor |String| #757575 | 取消按钮的颜色 |
| currentIcon |String| 默认图标 | 折叠时的图标 |
| defaultIcon |String| 默认图标 | 打开之后的图标 |
| lastIcon |String| 默认无 | 没有子集时的图标 |
| multiple |Boolean| true | 是否可以多选(true:多选、false:单选) |
| cascade |Boolean| false | 在多选时,选中父级,子集是否跟随选中(true:级联、false:不级联) |
| selectParent |Boolean| true | 父级是否可选(true:可选、false:不可选) |
| foldAll |Boolean| false | 父级折叠时是否折叠所有已经打开的子集(true:折叠、false:不折叠) |
| @cancel |Handler| - | 点击取消按钮时的回调方法 |
| @confirm |Handler| - | 点击确定按钮时的回调方法 |
#### 返回值说明
```vue
treeConfirm(e) {
console.log("你点击了确定")
console.log(e)
/**
* e==>
* [
* {id: "100", name: "测试100", value: "冗余值"}
* {id: "110", name: "测试110", value: "冗余值"}
* {id: "111", name: "测试111", value: "冗余值"}
* ]
* e为选中的数据数组
* e中的对象中有id(idKey指定的字段值)、name(nameKey指定的字段)、value(allKey指定的字段)
*/
},
```
#### 代码使用示例
```vue
<template>
<view>
<button @click="showTree" type="primary" style="width: 50%; margin-top: 20px;">
打开树形选择器
</button>
<peng-tree
ref="pengTree"
:range="range"
idKey="id"
nameKey="name"
allKey="value"
:multiple="false"
:cascade="false"
:selectParent="false"
:foldAll="false"
confirmColor="#007aff"
cancelColor="#757575"
title="标题"
titleColor="#757575"
@cancel="treeCancel"
@confirm="treeConfirm"
>
</peng-tree>
</view>
</template>
<script>
export default {
data() {
return {
range: [{
id: "100",
name: "测试100",
value: "冗余值",
children: [{
id: "110",
name: "测试110",
value: "冗余值",
children: [{
id: "111",
name: "测试111",
value: "冗余值",
}]
}]
},
{
id: "200",
name: "测试200",
value: "冗余值",
children: [{
id: "220",
name: "测试220",
value: "冗余值",
children: [{
id: "222",
name: "测试222",
value: "冗余值",
}]
}]
},
{
id: "300",
name: "测试300",
value: "冗余值"
}
]
}
},
methods: {
showTree() {
//打开选择器
this.$refs.pengTree._show();
//关闭选择器
//this.$refs.pengTree._hide();
},
treeCancel(e) {
console.log("你点击了取消")
console.log(e)
},
treeConfirm(e) {
console.log("你点击了确定")
console.log(e)
},
}
}
</script>
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
nbcio-boot亿事达企业管理平台V1.0.0版本配套uni-app (647个子文件)
icon.css 70KB
main.css 63KB
style.css 3KB
animation.css 3KB
mescroll-down.css 1KB
mescroll-up.css 892B
mescroll-uni.css 530B
mescroll-body.css 408B
w-picker.css 381B
.gitignore 217B
areadata.js 134KB
async-validator.js 38KB
parser.js 35KB
mescroll-uni.js 34KB
noNetwork.js 28KB
calendar.js 26KB
calendar.js 24KB
index.js 21KB
util.js 18KB
hooks.js 15KB
hooks.js 13KB
clipboard.min.js 13KB
concat.js 12KB
nvue - backup.js 12KB
Request.js 11KB
dayjs.js 11KB
util.js 8KB
clone.js 8KB
util.js 7KB
icons.js 7KB
util.js 7KB
nvue.js 7KB
mixin.js 7KB
style.js 7KB
transition.js 6KB
util.js 6KB
test.js 6KB
Request.js 6KB
props.js 6KB
props.js 5KB
nvue - 副本.js 5KB
nvue.js 5KB
props.js 5KB
urlQuery.js 5KB
index.js 5KB
routes.js 5KB
props.js 5KB
config.js 4KB
route.js 4KB
colorGradient.js 4KB
props.js 4KB
props.js 4KB
utils.js 4KB
value.js 4KB
init.js 4KB
mpother.js 4KB
digit.js 4KB
props.js 4KB
props.js 4KB
props.js 3KB
utils.js 3KB
navJump.js 3KB
h5-patch.js 3KB
props.js 3KB
props.js 3KB
mergeConfig.js 3KB
props.js 3KB
index.js 3KB
service.js 3KB
index.js 3KB
props.js 3KB
props.js 3KB
props.js 3KB
init.js 3KB
nvue.ani-map.js 3KB
socket.js 3KB
util.js 3KB
props.js 3KB
index.js 3KB
props.js 3KB
props.js 3KB
props.js 2KB
Mixin.js 2KB
h5-dom.js 2KB
props.js 2KB
props.js 2KB
props.js 2KB
props.js 2KB
props.js 2KB
utils.js 2KB
main.js 2KB
props.js 2KB
work.js 2KB
props.js 2KB
props.js 2KB
tip.js 2KB
MinCache.js 2KB
props.js 2KB
mixins.js 2KB
appUpdate.js 2KB
共 647 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
宁波阿成
- 粉丝: 1w+
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Javascript和Python的微商城项目设计源码 - MicroMall
- 基于Java的网上订餐系统设计源码 - online ordering system
- 基于Javascript的超级美眉网络资源管理应用模块设计源码
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功