当前位置:网站首页>在JEECG-boot代码生成的基础上修改list页面(结合自定义的组件)
在JEECG-boot代码生成的基础上修改list页面(结合自定义的组件)
2022-07-06 06:19:00 【瀚岳-诸葛弩】
先上效果图:
1、在后端创建接口,获取树节点。测试通过后即可。
2、创建前端组件
两个method的全部代码为:
methods: {
onLoadData(selectedNode) {
let that = this
let pid = 0
if (selectedNode != null) {
pid = selectedNode.dataRef.id
}
let params = new Object()
params.pid = pid
return new Promise(resolve => {
getAction("/jeecg-product/dict.device_catalog/dictDeviceCatalog/queryByPid", params).then(function(res) {
res.forEach(function(catalog){
let node = new Object()
node.key = catalog.id
node.title = catalog.deviceCatalog
node.isLeaf = (catalog.hasChild == 1?false:true);
node.id = catalog.id
node.pid = params.pid
node.icon = "gold"
node.children=[]
debugger
if(selectedNode != null){
node.path = selectedNode.dataRef.title + "-" + node.title
}
else{
node.path = node.title
}
if(selectedNode == null){
that.treeData.push(node)
}
else{
selectedNode.dataRef.children.push(node)
}
// that.allTreeNodes.push(node)
})
})
resolve();
})
},
onSelectNode(nodeId, e){
let param = new Object();
param.node = e.node.dataRef
param.id = e.node.dataRef.key
param.path = e.node.dataRef.path
param.title = e.node.dataRef.title
this.$emit("SelectNode",param)
}
},
需要注意的是ant-design-vue中,树控件的节点只有key,title,children,isleaf为强制要求(即:根据这些属性生成树),在使用的时候可以通过dataRef获取相对应的自行构建的节点对象。
自定义组件事件:
3、前端vue调用
边栏推荐
- Simulation volume leetcode [general] 1091 The shortest path in binary matrix
- 对数据安全的思考(转载)
- JWT-JSON WEB TOKEN
- G - Supermarket
- ICLR 2022 spotlight | analog transformer: time series anomaly detection method based on correlation difference
- sourceInsight中文乱码
- 黑猫带你学UFS协议第8篇:UFS初始化详解(Boot Operation)
- selenium源码通读·9 |DesiredCapabilities类分析
- JDBC Requset 对应内容及功能介绍
- Database isolation level
猜你喜欢
随机推荐
The pit encountered by keil over the years
Hypothesis testing learning notes
Full link voltage measurement: building three models
MySQL之基础知识
Still worrying about how to write web automation test cases? Senior test engineers teach you selenium test case writing hand in hand
模拟卷Leetcode【普通】1219. 黄金矿工
E - food chain
Is the test cycle compressed? Teach you 9 ways to deal with it
Simulation volume leetcode [general] 1062 Longest repeating substring
测试周期被压缩?教你9个方法去应对
Simulation volume leetcode [general] 1143 Longest common subsequence
联合索引的左匹配原则
CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全
selenium源码通读·9 |DesiredCapabilities类分析
模拟卷Leetcode【普通】1091. 二进制矩阵中的最短路径
Play video with Tencent video plug-in in uni app
F - true liars (category and search set +dp)
Isam2 and incrementalfixedlagsmooth instructions in gtsam
MFC 动态创建的对话框及改变控件的大小和位置
Simulation volume leetcode [general] 1405 Longest happy string