当前位置:网站首页>在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调用
边栏推荐
猜你喜欢
Overview of three core areas of Mathematics: algebra
JMeter做接口测试,如何提取登录Cookie
数据库隔离级别
MFC on the conversion and display of long string unsigned char and CString
F - true liars (category and search set +dp)
sourceInsight中文乱码
在uni-app中使用腾讯视频插件播放视频
Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
[postman] collections - run the imported data file of the configuration
【Tera Term】黑猫带你学TTL脚本——嵌入式开发中串口自动化神技能
随机推荐
MFC 动态创建的对话框及改变控件的大小和位置
Qt:无法定位程序输入点XXXXX于动态链接库。
Manhattan distance sum - print diamond
Simulation volume leetcode [general] 1296 Divide an array into a set of consecutive numbers
PAT(乙级)2022年夏季考试
Simulation volume leetcode [general] 1109 Flight reservation statistics
10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
Idea new UI usage
Simulation volume leetcode [general] 1062 Longest repeating substring
Application du Groupe Li dans gtsam
Career advancement Guide: recommended books for people in big factories
[C language] string left rotation
Isam2 and incrementalfixedlagsmooth instructions in gtsam
win10无法操作(删除、剪切)文件
G - Supermarket
[wechat applet] build a development tool environment
D - How Many Answers Are Wrong
【C语言】字符串左旋
模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
二维码的前世今生 与 六大测试点梳理