Using Vue in a project built by Webpack

Source: Internet
Author: User

One
Review the use of Vue in a normal web page
1. Using script to introduce Vue
2. Create a container with ID as app in index
3. Get VM instances with new Vue
Two
Try using Vue in Webpack:
Note: The Vue constructor imported by using the import vue from ' Vue ' in webpack is not fully functional and provides only the Runtime-onley way the disease does not provide a way to use it in a Web page.
NPM Install Vue-s

Import vue from ' Vue '
Import Vue from '. /node_modules/vue/dist/vue.js '

var vm = new Vue ({
El: ' #app ',
data:{
Msg: ' 123 '
}
})

Webpack.config.js

Resoleve: {
alias:{//modifying the path of the Vue when the package is imported
' vue$ ': ' Vue/dist/vue.js '
}
}

Using Vue in a project built by Webpack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.