1.设置快速提示
"http-get请求": {
"prefix": "httpget",
"body": [
"this.\\$http({",
"url: this.\\$http.adornUrl(''),",
"method: 'get',",
"params: this.\\$http.adornParams({})",
"}).then(({ data }) => {",
"})"
],
"description": "httpGET请求"
},
"http-post请求": {
"prefix": "httppost",
"body": [
"this.\\$http({",
"url: this.\\$http.adornUrl(''),",
"method: 'post',",
"data: this.\\$http.adornData(data, false)",
"}).then(({ data }) => { });"
],
"description": "httpPOST请求"
}
2.MessageBox 弹框删除分类
删除时危险操作,需要提示用户
remove(node, data) {
var ids = [data.catId];
this.$confirm(`是否删除【${data.name}】菜单`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.$http({
url: this.$http.adornUrl("/product/category/delete"),
method: "post",
data: this.$http.adornData(ids, false),
}).then(({ data }) => {
console.log("删除成功");
this.getMenus(); //获取菜单
});
}).catch(() => {
});
console.log("append", node, data);
},
3.Message 消息提示成功失败
this.$message({
message: '恭喜你,这是一条成功消息',
type: 'success'
});
4.删除成功后,展开以前的父节点
参考属性:
node-key 每个树节点用来作为唯一标识的属性,整棵树应该是唯一的 String — —
default-expanded-keys 默认展开的节点的 key 的数组 array — —
node-key="catId"
:default-expanded-keys="expandedkey"
//data返回值对象中添加‘:default-expanded-keys’对应的属性
expandedkey: [],
//刷新出新的菜单
this.getMenus();
//删除成功后,设置需要默认展开的菜单
this.expandedkey = [node.parent.data.catId];