


Develop backend system based on vue modularization - build project
Mar 30, 2018 pm 01:56 PMThis article shares with you the modular development backend system based on vue. Interested friends can take a look at this article.
The article directory is as follows:
Based on vue modular development backend System - preparation work
Based on vue modular development backend system-building project
Preface
After getting familiar with the preparation tools mentioned in the previous article, now Start building your own project. This is a VUE project. Then use vue-cli to build it. Enter the following command
vue init webpack xxxx
During the building process, because of the need to standardize the code as mentioned before, I asked this question in eslint , please reply Y
. After everything is over, let's take a look at the directory structure
Project directory structure
Of course, some additions have been made to this directory, and remarks have been made (added)
, the ones without remarks are the same
├── build // 构建相关 ├── config // 配置相关 ├── dist // 打包之后相关 ├── node_modules // npm相关包 ├── src // 代码 │ ├── api // 请求接口文件(加) │ ├── assets // 静态资源(图片,样式等) │ ├── components // 全局公用组件 │ ├── directives // 全局指令(加) │ ├── mock // 项目mock 模拟数据(加) │ ├── pages // 相关页面(加) │ ├── router // 路由 │ ├── store // store管理(加) │ ├── App.vue // 入口页面 │ └── main.js // 入口 加载组件 初始化等 ├── static // 第三方不打包资源 ├── .babelrc // babel-loader 配置 ├── .eslintignore // eslint 忽略项 ├── .eslintrc.js // eslint 配置项 ├── .postcssrc.js // postcss 配置项 ├── .gitignore // git 忽略项 ├── index.html // html模板 └── package.json // package.json
Analyze these first, if you don’t see the node_modules
folder, don’t worry about it for now, then look down and add api,directives,mock,pages,store
These folders have their respective functions
-
api:Interface for storing project simulation
directives: Storage global directives of the project
##mock:Storage usagemock.js
Simulated data
pages:Storage project-related pages
store: Storage state management
Open this file and find the
devDependencies attribute, where we add the packages required by the project, for example:
- "axios": "^0.17. 0",//Request tool
- "js-cookie": "^2.2.0",//Cookie
- "lodash" : "^4.17.4",//Function library
- "mockjs": "^1.0.0",//Simulation data tool
- "vuex": "^3.0.1",//State management tool
- "vee-validate": "^2.0.0"//Form validation tool
npm install --save-dev
Taobao Mirror, as follows
npm install --save-dev --registry=http://registry.npm.taobao.org
npm show 包名或者插件名称 versions --json
npm install 包名或者插件名称@版本 --save-dev --registry=http://registry.npm.taobao.org
node_modules folder
Personal modification, for reference only
After completing the above steps, you still need to modify the configuration.Modify port
First find the directoryconfig, then find the file
index.js, open it and find ## For the configuration item of #dev
, since the default port is 8080
, in order to prevent port conflicts with other projects, find the port
option and change it to your favorite port
Find the
dev configuration item as above, and then find autoOpenBrowser
, the default isfalse
, now changed to true
.
Due to the problem that pictures and styles do not appear after packaging, I don’t know if you have the same problem, so I have made the following modifications:
configFind the file index.js
in this directory, open the configuration item found in build
, and add assetsPublicPath: './ '
Then find the file
in the build
directory, and then find the following code: <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader',
})</pre><div class="contentsignin">Copy after login</div></div>
in the configuration item Add
This part is for reference only, if you can ignore it for now, it appears It is possible to look back at the same problem again and it will not hinder the construction of the project. Once the build is complete, let’s start coding!
ArticleDeveloping a backend system based on vue modularization - preparation workDeveloping a backend system based on vue modularization-building a project
Related recommendations:
The above is the detailed content of Develop backend system based on vue modularization - build project. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Discuz background login problem solution revealed

CUDA's universal matrix multiplication: from entry to proficiency!

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time

Which version of Apple 16 system is the best?

What are the computer operating systems?

Are you worried about WordPress backend garbled code? Try these solutions

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use

Differences and similarities of cmd commands in Linux and Windows systems
