javascript - Where should vue2 public methods be written?
过去多啦不再A梦
过去多啦不再A梦 2017-05-19 10:21:22
0
6
709

vue2 Where should public methods be written?

过去多啦不再A梦
过去多啦不再A梦

reply all(6)
黄舟

Create a utils under lib, just import it when you want to use it

滿天的星座

Write a util.js and write the methods here. Be careful to expose it as a module. When using it, import it, and then you can use the methods inside

为情所困

Write a separate JS file, and then expose the method. The VUE page refers to your JS file to call the exposed method

習慣沉默

You can also use mixins

迷茫

Use vueX? Just write it in actions, so that it can be easily called in the component. If you write additional js, it will be troublesome to import every time

刘奇

Public methods have nothing to do with vue instances

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template