Vue2 Rewrite Cnodejs Community app

Source: Internet
Author: User

Refer to original author open source code: Https://github.com/shinygang/Vue-cnodejs

Learning projects with the aim of learning, practicing and improving

node:v6.9.5 npm:3.10.10 vue:2.8.1

1. Project Construction

Installing the VUE-CLI scaffold NPM i vue-cli-g

Create a Webpack project and download dependent vue init webpack Vue-cnodejs

Install dependent CD Vue-cnodejs

NPM I

hot start npm run dev successfully pops up Web page and builds successfully

Installing Vuex NPM i Vuex--save

Fastclick Eliminate Click Delay

Zepto Lightweight, jquery-compatible JavaScript library

Installing the Sass Loader NPM install Node-sass--save-dev

NPM Install Sass-loader--save-dev

In the. vue file via <style lang= "SCSS" ></style> use

//   build/webpack.base.conf.js    module: {    rules: [      ...      ] {        /\.scss$/,        loaders: ["Style", "CSS", "sass"]      },      ...    ]  }

2. Initialization

 Modifications to index.html and main.js, no longer using APP.VUE as the initialization component, directly using the Index.vue as the initialization component

Index.html
<! DOCTYPE html>

Lazy loading of the route, where the original author's writing has been changed, the specific content can refer to http://router.vuejs.org/zh-cn/advanced/lazy-loading.html

In addition, a number of changes have been made to the directory structure of the original author, incorporating components and views (the reason why the original author was not separated)

// The original author's wording // Require.ensure is a special syntax for Webpack, which is used to set the Code-splitPoint const Home = Resolve = {    require.ensure ([' .. /components/index.vue '], () = {        resolve (require (' ... /components/index.vue '     ));}; // in accordance with the AMD specification, const HOME = Resolve = require ([' ... /components/index.vue '],resolve);

Vue2 Rewrite Cnodejs Community app

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.