摘要: 使用import需要babel编译写法如下 项目中使用sass 辅助工具安装 MongoDB(http://www.runoob.com/mongodb/mongodb-window-install.html) redis(http://www.runoob.com/redis/redis-inst 阅读全文
posted @ 2019-04-17 00:22 空瓶子装满了 阅读(637) 评论(0) 推荐(0) 编辑
摘要: 使用asyncData就是服务端渲染,computed只是浏览器的渲染刷新会有闪烁 阅读全文
posted @ 2019-04-16 02:09 空瓶子装满了 阅读(599) 评论(0) 推荐(0) 编辑
摘要: //在server/interface/city.js import Router from 'koa-router'; const router = new Router({ prefix:'/city' //给路由添加前缀 }) router.get('/list', async (ctx) => { ctx.body=['北京','天津'] }) export def... 阅读全文
posted @ 2019-04-16 01:35 空瓶子装满了 阅读(791) 评论(0) 推荐(0) 编辑
摘要: layout是页面模板,主要是为了做到无论在任何页面都会显示的内容,例如头部header,或者nav导航,页脚等固定页面。nuxt配置以及layout具体参考(https://cloud.tencent.com/developer/article/1330974) 1.如果项目中存在 layouts 阅读全文
posted @ 2019-04-16 01:15 空瓶子装满了 阅读(981) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-04-16 01:07 空瓶子装满了 阅读(859) 评论(0) 推荐(0) 编辑
摘要: const router = require('koa-router')() //返回一个页面 router.get('/', async (ctx, next) => { global.console.log('index11111'); await ctx.render('index', { //render返回一个页面 title: 'Hello Koa 2!' ... 阅读全文
posted @ 2019-04-14 03:59 空瓶子装满了 阅读(268) 评论(0) 推荐(0) 编辑
摘要: function pv(ctx){ global.console.log(ctx.path); } module.exports=function(){ return async function(ctx,next){ pv(ctx); await next(); //next是继续执行下面的中间件,如果不写会直接跳出,不会继续执行 } ... 阅读全文
posted @ 2019-04-14 03:41 空瓶子装满了 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1.npm install -g koa-generator 2.koa2 项目名称,如果需要ejs引擎koa2 -e 项目名称 3.cd 项目名称 4.npm install 5.npm install --update-binary 6.npm run dev 小知识点:对于start和test 阅读全文
posted @ 2019-04-12 23:01 空瓶子装满了 阅读(550) 评论(0) 推荐(0) 编辑
摘要: //v-bind:id="变量" or :id="变量" 阅读全文
posted @ 2019-04-12 00:51 空瓶子装满了 阅读(2814) 评论(0) 推荐(0) 编辑
摘要: 如果返回的数据是html标签字符串的话,在vue里要通过v-html来渲染 阅读全文
posted @ 2019-04-12 00:39 空瓶子装满了 阅读(20863) 评论(0) 推荐(2) 编辑