zoukankan      html  css  js  c++  java
  • v-resource

    1,主页使用 app.vue

    
    

    data() {
      return {
        seller:{}
      }
    },
    created() {
      this.$http.get('/api/seller').then((response) => {
      response = response.body;
      if(response.errno===ERR_Ok){
        this.seller = response.data;
        console.log(this.seller);
        }
      });

    },

      created() {
          this.$http.get('/api/seller').then((response) => {
            response = response.body;
            if(response.errno===ERR_Ok){
              this.seller = response.data;
              console.log(this.seller);
            }
          });
        },

    2,devserver.js 设置

    var app = express()
    
    var appData = require('../data.json');
    var seller = appData.seller;
    var goods = appData.goods;
    var ratings = appData.ratings;
    
    var apiRoutes = express.Router();
    
    apiRoutes.get('/seller', function (req, res) {
      res.json({
        errno: 0,
        data: seller
      });
    });
    
    apiRoutes.get('/goods', function (req, res) {
      res.json({
        errno: 0,
        data: goods
      });
    });
    
    apiRoutes.get('/ratings', function (req, res) {
      res.json({
        errno: 0,
        data: ratings
      });
    });
    
    app.use('/api', apiRoutes);
    若有恒,何须三更睡五更起;最无益,莫过于一日曝十日寒
  • 相关阅读:
    .htaccess是什么?.htaccess几个简单应用
    php提高效率
    php require和include区别
    excel的常用公式
    php时间日期处理
    json详解
    python列表-增强的赋值操作
    python列表-使用
    python列表-简单操作
    python列表-定义
  • 原文地址:https://www.cnblogs.com/21haoxingxiu/p/7267471.html
Copyright © 2011-2022 走看看