Vue introduced custom JS Detailed steps

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
Published 65 original articles · won praise 8 · views 160 000 +

Guess you like

Origin blog.csdn.net/u012382791/article/details/100501321