摘要:
使用import需要babel编译写法如下 项目中使用sass 辅助工具安装 MongoDB(http://www.runoob.com/mongodb/mongodb-window-install.html) redis(http://www.runoob.com/redis/redis-inst 阅读全文
摘要:
使用asyncData就是服务端渲染,computed只是浏览器的渲染刷新会有闪烁 阅读全文
摘要:
//在server/interface/city.js import Router from 'koa-router'; const router = new Router({ prefix:'/city' //给路由添加前缀 }) router.get('/list', async (ctx) => { ctx.body=['北京','天津'] }) export def... 阅读全文
摘要:
layout是页面模板,主要是为了做到无论在任何页面都会显示的内容,例如头部header,或者nav导航,页脚等固定页面。nuxt配置以及layout具体参考(https://cloud.tencent.com/developer/article/1330974) 1.如果项目中存在 layouts 阅读全文
摘要:
1.使用 npm 安装 npm install -g vue-cli 2.安装nuxt项目 vue init nuxt-community/koa-template 项目名称 3.如果 vue-cli 没有安装, 需先通过 npm install -g vue-cli 来安装。 4.进入项目npm 阅读全文
摘要:
const router = require('koa-router')() //返回一个页面 router.get('/', async (ctx, next) => { global.console.log('index11111'); await ctx.render('index', { //render返回一个页面 title: 'Hello Koa 2!' ... 阅读全文
摘要:
function pv(ctx){ global.console.log(ctx.path); } module.exports=function(){ return async function(ctx,next){ pv(ctx); await next(); //next是继续执行下面的中间件,如果不写会直接跳出,不会继续执行 } ... 阅读全文