上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 142 下一页
摘要: 1.安装 ejs yarn add egg-view-ejs 2.修改配置 config/plugin.js 'use strict'; exports.ejs = { enable: true, package: 'egg-view-ejs' }; config/config.default.js 阅读全文
posted @ 2020-03-02 12:00 每天都要进步一点点 阅读(1587) 评论(0) 推荐(0)
摘要: 1.创建service文件 app/service/product.js const Service = require('egg').Service; class ProductService extends Service { async index() { return { id: 100, 阅读全文
posted @ 2020-03-01 12:00 每天都要进步一点点 阅读(2180) 评论(0) 推荐(1)
摘要: 1.GET 方法 // 商品详情 async detail() { const { ctx } = this; console.log(ctx.query); ctx.body = `id==${ctx.query.id}`; } async detail2() { const { ctx } = 阅读全文
posted @ 2020-02-29 12:00 每天都要进步一点点 阅读(2210) 评论(0) 推荐(0)
摘要: 方式一:query 获取方式 async detail() { // 获取上下文 const { ctx } = this; console.log('方式一:query', ctx.query); ctx.body = `id==${ctx.query.id}`; } 路由配置 router.ge 阅读全文
posted @ 2020-02-28 12:00 每天都要进步一点点 阅读(1363) 评论(0) 推荐(0)
摘要: 1.创建 product 控制器 app/controller/product.js const Controller = require('egg').Controller; class ProductController extends Controller { async index() { 阅读全文
posted @ 2020-02-27 12:00 每天都要进步一点点 阅读(796) 评论(0) 推荐(0)
摘要: 1.创建文件夹 mkdir egg-demo cd egg-demo 2.初始化 npm init egg --type=simple yarn install 3.运行项目 yarn dev 4.项目目录 阅读全文
posted @ 2020-02-26 12:00 每天都要进步一点点 阅读(637) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2020-02-25 12:00 每天都要进步一点点 阅读(3) 评论(0) 推荐(0)
摘要: 1.需要在 安全组 中添加 tcp端口 2.开启端口 firewall-cmd --zone=public --add-port=8090/tcp --permanent . 阅读全文
posted @ 2020-02-24 12:00 每天都要进步一点点 阅读(119) 评论(0) 推荐(0)
摘要: 1.安装 http-proxy-middleware 模块 yarn add http-proxy-middleware "http-proxy-middleware": "^1.0.1" 2.在 src 文件夹下 创建 setupProxy.js 文件 const { createProxyMid 阅读全文
posted @ 2020-02-23 12:00 每天都要进步一点点 阅读(3351) 评论(0) 推荐(1)
摘要: 在 package.json 中添加 proxy: "proxy": "http://106.13.9.213:9000" 页面中调用: async componentDidMount() { let res = await axios.get('/admin/category'); console 阅读全文
posted @ 2020-02-22 12:00 每天都要进步一点点 阅读(648) 评论(1) 推荐(0)
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 142 下一页