1. Create a custom JS:
/my-project/static/xxx.js
2.xxx.js increase export for external calls:
let OPT_TITLE = { "create": "新建", "update": "编辑", "delete": "删除", "detail": "详情", "select": "查询", }; export { OPT_TITLE, }
3. In the module needs to be introduced:
import {OPT_TITLE} from "../../static/xxx.js"// note the path adjustment
4. Call:
// button 2 h('Button', { props: { type: 'error', size: 'small' }, on: { click: () => { this.remove(params.index) } } }, OPT_TITLE.delete) // call directly OPT_TITLE.delete