Home layout and routing settings
This section begins the layout of the first page, the course adopts the principle of quiet, first, the static data instead, and then using mock simulation data, the last real interface. The advantage is that you can meet the different stages of different positions of the small partner kinetic energy enjoyable start-up project.
The three basics of this lesson:
1. Home routing configuration: this if there is a basis can skip learning.
2. Set up the homepage component (components): First set up the homepage components.
3. Explain the layout of the vant: I hope that the weight of my CSS is not too much of the course content, so in order to minimize the involvement of CSS, we introduced a third-party style component library.
User-scalable settings
First to fill a previous lesson forgot to add the properties, in the mobile page adaptation, generally we do not want users to scale their own page size, we can index.html set in the meta label, join user-scalable=no .
Configuration of the home route
Open the Routing configuration page: src/router/index.js first remove the VUE-CLI auto-generated HelloWorld.vue configuration, and then join our routing configuration.
import vue from ' Vue ' vue-router' @/components/pages/shoppingmall 'default New Router ({ routes: [ '/', Name: ' Shoppingmall ', Component:shoppingmall} ]})
The @ here represents the SRC directory of the project.
Create a home Page component
Delete HelloWorld.vue files, create ShoppingMall.vue files. Write the following code:
<template> <div> {msg}} </div></template> <script> default { data () { return { ' shopping Mall ' }}} </ Script>
Vant Layout Explanation
Layouts that use vant need to be introduced on demand first, and we /scr/main.js introduce Row and component directly in Col .
Import {button, row, Col} from ' Vant 'vue.use (button). Use (Row). Use (COL)
His layout is a 24-grid layout method, the simple understanding is that the page evenly divided into 24 equal portions, and then we control the proportion of the 24 divide can be achieved layout.
<van-row> <van-col span= "8" >span:8</van-col> <van-col span= "8" >span:8</ van-col> <van-col span= "8" >span:8</van-col></van-row>
VUE.JS+KOA2 Mobile e-commerce combat 4