代码拉取完成,页面将自动刷新
同步操作将从 一枚码农/v-tree 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
基于vue树形菜单
en:A demo path: v-tree/src/components/vTreeDemo.Vue
zh:一个demo的路径: v-tree/src/components/vTreeDemo.Vue
zh:单选、复选、复选是/否级联选择(默认级联选中)、是否展示下拉虚线、点击节点回调函数,返回true 选中并触发选中事件,false相反,
节点选中事件,返回选中节点信息和上个选中节点信息,选中/取消选中复选框事件,将返回所有选中复选框数据
异步加载数据
vue自定义变量和函数说明
Default single selection
:treeNode type:json default:[]
标准json tree节点,name属性必填
:allOpen type:boolean default:false
开启/关闭所有节点
:nodeTrigger type:boolean default:false
点击节点是否触发节点事件
@call type:Function parameter:inside treeNode,You can change it and the page will be re-rendered.
初始化回调函数 参数为节点数据的深拷贝,你可以修改此数据,tree将会重新渲染
:beforeClick type:Function parameter:Current node information(参数:当前节点信息)
击节点前触发回调函数,return false 无法触发clickNode事件
:clickNode type:Function parameter 1:Current node information,parameter 2:Last selected node information(上一个选中的节点信息)
点击节点 回调函数
:checkBox type:boolean default:false
开启/关闭复选框
:checkBoxType type:boolean default:true
开启/关闭级联选中
@checkBoxCall type:Function parameter:All selected node sets(所有选中的节点集合)
选中/取消选中复选框回调函数
:async type:boolean default:false
是否开启异步 默认关闭
:asyncCall type:Function parameter 1:Current node information,parameter 2:callback function,Receive an array parameter
Example:
asyncCall(data, call) { //data:Current node information
setTimeout(function () {
let hm = '' + (new Date()).getTime();
let addNode = [
{id: hm, name: "children node" + hm.substr(hm.length - 4, hm.length)},
];
call(addNode); //callback function
}, 800);
}
异步回调函数function(data,call),data:current node, call 回调执行,接收一个数组参数
一个完整的示例:
<Tree
:treeNode="treeNode"
:allOpen="allOpen"
:nodeTrigger="nodeTrigger"
:checkBox="checkBox"
:beforeClick="beforeClick"
:checkBoxType="checkBoxType"
:clickNode="clickNode"
:hiddenLine="hiddenLine"
@checkBoxCall="asyncCheckBoxCall"
@call='callAsync'
:async="async"
:asyncCall="asyncCall"
/>
# install dependencies
npm install
# serve with hot reload at localhost:8089
npm run dev
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。