The vue project can directly introduce vue.js. The introduction method: 1. Use the scaffolding tool [vue-cli]; 2. The second is to directly introduce [vue.js] into the project, the code is [var vm = new Vue({el: '#accountManage',data: {},})].
【Recommended related articles: vue.js】
vue project can directly introduce vue.js, the introduction method:
I used layUI to do it in a recent project. When I got it, I thought I use vue and don’t want to move the page again. I just reference vue.js. When I encounter the following problems, I would like to share with you the following
1. Let’s talk about how to use it. After referencing vue.js on the page
var vm = new Vue({ el: '#accountManage', //挂载点 data: {}, })
new A vue object is mounted in the outermost box of the current page, so that vue syntax can be used on the entire page
2. When the arrow function of es6 is changed to a normal function, The this reference here will change. I usually redefine this at the beginning of the function
getListData:function (){ var that = this; })
3. I use vue layUI. There is a small problem. When there is a definition ID in the html When defining variables or JSON in vue, avoid this ID string, because it will turn out garbled characters
<select name="interest" lay-filter="rule" v-model="tradeMemberProperty" id="nature"></select>
At this time, the output
mounted:function(){ console.log('nature'+'这是vue的测试') },
The result will be like this, natrue is converted to Garbled characters were found when sending a request to define JSON
Related free learning recommendations:javascript(Video)
The above is the detailed content of Can vue projects directly introduce vue.js?. For more information, please follow other related articles on the PHP Chinese website!