Home > Web Front-end > JS Tutorial > body text

Vue.js 2.0 backend system practical case

php中世界最好的语言
Release: 2018-03-07 17:37:31
Original
1745 people have browsed it

This time I will bring you a practical case of the Vue.js 2.0 backend system. What are the precautions for the actual use of the Vue.js2.0 backend system? The following is a practical case, let’s take a look.

My friend recently wanted to make an OA for his own use to practice his skills (PS, he has always wanted to start a business), so he asked me to do it with him. Since time is limited recently, I helped him write a framework for himself. Use it.

I use yarn to manage the project (really not following the trend), of course you can also use Npm management

First use vue-cliInitialize the project, and then install Vue-router Vuex element, since my friend has never done front-end work, I chose element to quickly develop the page. After installing all dependencies Directory structure is like this

Directory structure

What needs to be noted here is that each of my components is a folder composed of index.vue script. js style.sass template.jade file, which can be easily formatted in the editor. When referencing, you only need to quote the folder

e.g.
import NotFound from './views/404';
index.vue
<style lang="sass" scoped src="./style.sass"></style><template lang="jade" src="./template.pug"></template><script src="./script.js"></script>
script.js
export default {  data() {    return {    }  },  components: {  }}
sass
.red  color: red
Copy after login

Because the project generated by vue-cli webpack does not use jade, you need to add webpack's jade-loader

Note that you need to install pug-html-loader jade

...
     {        test: /\.pug$/,
        loader: &#39;vue-html!pug-html&#39;
      },
...
Copy after login

Sass support

In order to support Sass, you need to install sass-loader node-sass

Vue-resourceI have installed it and haven’t decided to use it yet. I may use Ajax. If I use Ajax, I will use the reqwest library

The project here refers to the best practical process of building a single-page application with vue2.0, so the functions of the examples are the same~

Please Star github

I believe you have already read the case in this article After mastering the method, please pay attention to other related articles on the php Chinese website for more exciting content!

Related reading:

js knowledge about BOM operations compiled

10 js regular expressions Applications

The above is the detailed content of Vue.js 2.0 backend system practical case. 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!