VUE.JS+KOA2 Mobile e-commerce combat 4

Source: Internet
Author: User

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

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.