Vue笔记(七)—— Vue 引入自定义JS步骤详解
1.创建自定义JS:/my-project/static/xxx.js2.xxx.js增加export供外部调用:let OPT_TITLE = {"create": "新建","update": "编辑","delete": "删除","detail": "详情","select": "查询",};export {OPT_TITLE,...
·
1.创建自定义JS:
/my-project/static/xxx.js
2.xxx.js增加export供外部调用:
let OPT_TITLE = {
"create": "新建",
"update": "编辑",
"delete": "删除",
"detail": "详情",
"select": "查询",
};
export {
OPT_TITLE,
}
3.在需要的模块引入:
import {OPT_TITLE} from "../../static/xxx.js"// 注意路径调整
4.调用:
// 按钮2
h('Button', {
props: {
type: 'error',
size: 'small'
},
on: {
click: () => {
this.remove(params.index)
}
}
}, OPT_TITLE.delete)//直接OPT_TITLE.delete调用
更多推荐
已为社区贡献3条内容
所有评论(0)