Home > Web Front-end > Vue.js > body text

Can vue projects directly introduce vue.js?

coldplay.xixi
Release: 2020-11-17 15:32:31
Original
2883 people have browsed it

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: {},})].

Can vue projects directly introduce vue.js?

【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: {},
})
Copy after login

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;
})
Copy after login

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>
Copy after login

At this time, the output

mounted:function(){
console.log(&#39;nature&#39;+&#39;这是vue的测试&#39;)
},
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!