Vue introduces its own encapsulated function problem.

  1. encapsulates a function a.js , which is a complete function without writing exposure. function a () {}
  2. after I introduced it in vue, I made a mistake in using the Times, saying an is not defined
  3. it works when I write the function in vue"s methods.
  4. I would like to ask you how to solve this?
Apr.01,2021

in a.js, export {a}, in main.js, import {a} from'/ a.js' Vue.prototype.a = a, so you can try calling a function in the component


export default function a () {} and then import a from. / a.js

.
Menu