vue仿饿了么项目总结2

Vue.js饿了么

Q为遇到的坑报的错 有相应解决方法,BQ为注意点。

const express = require('express');
const app = express();
const appData = require('../data.json');
const seller = appData.seller;
const goods = appData.goods;
const ratings = appData.ratings;

const apiRoutes = express.Router();

app.use('/api',apiRoutes);

before(app) {
      app.get('/api/seller', (req, res) => {
        res.json({
          errno: 0,
          data: seller
        })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用
      }),
      app.get('/api/goods', (req, res) => {
        res.json({
          errno: 0,
          data: goods
        })
      }),
      app.get('/api/ratings', (req, res) => {
        res.json({
          errno: 0,
          data: ratings
        })
      })
}

布局与样式:

<div class="detail" v-show="detailShow">
        <div class="detail-wrapper clearfix">
          <div class="detail-main">
           
          </div>
        </div>

        <div class="detail-close">
          
        </div>
</div>

.detail-wrapper
    min-height: 100%
    .detail-main
      margin-top:64px
      padding-bottom:64px
.detail-close
    width: 32px
    height:32px
    margin:-64px auto 0px auto
    font-size: 32px
    position:relative
<template>
  <div class="star" :class="starType">
    <span v-for="itemClass in itemClasses" :class="itemClass" class="star-item"></span>
  </div>
</template>

解决:1.用better-scroll插件时,参数要加click:true 2.使用Better-scroll时,绑定的元素里面只能有一个子元素。

.pic
  position: relative
  width: 100%
  height: 0
  padding-top: 100%
  & img
    position: absolute
    top: 0
    left: 0
    width: 100%
    height: 100%
Export default{}
Import xxx from “”;

Export function xxx(){}
Import {xxx1xxx2} from “”;
Table of Contents