当前位置:网站首页>在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调用
边栏推荐
- PAT(乙级)2022年夏季考试
- Technology sharing | common interface protocol analysis
- Is the test cycle compressed? Teach you 9 ways to deal with it
- 【无App Push 通用测试方案
- Simulation volume leetcode [general] 1249 Remove invalid parentheses
- LeetCode 739. 每日温度
- Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
- 模拟卷Leetcode【普通】1249. 移除无效的括号
- 模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
- 数据库-当前读与快照读
猜你喜欢
随机推荐
Digital triangle model acwing 1015 Picking flowers
通过修改style设置打印页样式
Réflexions sur la sécurité des données (réimpression)
【Tera Term】黑猫带你学TTL脚本——嵌入式开发中串口自动化神技能
E - 食物链
Simulation volume leetcode [general] 1447 Simplest fraction
Caused by:org. gradle. api. internal. plugins . PluginApplicationException: Failed to apply plugin
LeetCode 732. 我的日程安排表 III
Overview of three core areas of Mathematics: algebra
An article was uncovered to test the truth of outsourcing companies
selenium源码通读·9 |DesiredCapabilities类分析
F - true liars (category and search set +dp)
模拟卷Leetcode【普通】1062. 最长重复子串
MFC dynamically creates dialog boxes and changes the size and position of controls
LeetCode 1200. 最小绝对差
Still worrying about how to write web automation test cases? Senior test engineers teach you selenium test case writing hand in hand
Qt:无法定位程序输入点XXXXX于动态链接库。
Full link voltage measurement: building three models
[postman] the monitors monitoring API can run periodically
Win10 cannot operate (delete, cut) files