This time I will show you how to use vue-cli scaffolding initialization, what are the precautions when using vue-cli scaffolding, the following is a practical case, let's take a look.
vue-cli is an official command line tool provided by Vue, which can be used to quickly build large-scale single-page applications. The tool provides out-of-the-box build tool configuration, bringing a modern front-end development process. It only takes a few minutes to create and launch a project with hot reload, static checks on save, and a production-ready build configuration.
Using vue-cli has the following major advantages:
vue-cli is a mature Vue project architecture design that will be updated as the Vue version changes
vue-cli provides a set of local hot-loading test servers
vue-cli integrates a set of packaging and online solutions, which can Use build tools such as webpack or Browserify
##Install
To install vue-cli# 必须全局安装vue-cli,否则无法使用vue命令 # 安装完成之后使用vue -V检查vue-cli是否安装成功及版本信息 $ npm install -g vue-cli $ vue -V
# 项目创建完之后需要执行npm install安装依赖 $ vue init webpack vuedemo $ npm install
[index.html]
index.html is the same as other html files, but generally only an empty root node is defined, and the instance defined in main.js will be hung Loaded under the root node, the content is filled through vue components. Since all mounting elements will be replaced by the DOM generated by Vue, it is not recommended to directly mount the instance to or
on.
[main.js]
is the[App.vue]
The root component of the project can contain other sub-components to form a component tree[router/index.js]
RoutingConfiguration file, the function is to map components to routes, so that you can know where to render them
How to update the array with $set in vue.js
How to split code based on webpack
The above is the detailed content of How to use vue-cli scaffolding initialization. For more information, please follow other related articles on the PHP Chinese website!