utils.js
1 const pubJs = { 2 methods: { 3 GetNumber () { 4 return console.log('1111111111111') 5 } 6 } 7 } 8 9 export default pubJs
main.js
1 import pubJs from './utils' 2 3 Vue.mixin(pubJs)
调用
1 this.GetNumber()
utils.js
1 const pubJs = { 2 methods: { 3 GetNumber () { 4 return console.log('1111111111111') 5 } 6 } 7 } 8 9 export default pubJs
main.js
1 import pubJs from './utils' 2 3 Vue.mixin(pubJs)
调用
1 this.GetNumber()