Nuts.js01
1、简介
Vue ssr框架。支持vue2,vue-router,vuex,vue server render, vue meta

2、基本使用:
vue init nuxt-community/koa-template //基于koa2的安装
接着cnpm i
npm run dev开启服务
观察Nuxt.js目录:

pages入口页面组件
在page中的vue模板文件名称都是路径
创建完成后即可在相应路由处访问,无需手动配置路由
查看相应页面我们发现系统还自动配置了一行文字
来源于layouts中的模板文件,里面存放着公共的组件,比如说需要在所有路由下都显示的头部,尾部,侧边栏等
每新建一个组件,都会自动添加相应的组件
pages中的页面组件会放到layouts内模板组件中的nuxt标签内
自定义一个简单的layout模板

这样我们在pages下模板使用时在script标签下export default内声明
layout:'your layouts name'
nuxt.config.js是nuxtjs的配置文件,
可以配置全局的css文件
nuxt获取异步数据
server目录创建interface接口目录
目录下创建接口文件:

接着在server文件夹下入口文件index.js中引入
import name from '...'
同一文件下接着书写:

即可
接着可在模板文件中使用:

这里未配置ssr客户端渲染,是我们的页面在页面加载完后再向服务器发起请求:
为了实现在下发资源的同时进行渲染,我们修改:

这样会把数据和编译好的内容一并返回给浏览器
fetch主要用于处理vuex相关的数据

vuex结合使用nuxtjs
方法与单独使用nuxtjs类似

在路由index.js入口文件书写:

此时,vuex已经可以运行,如果不行,请重启服务。
也是实现了ssr

在此总结nuxt目录下各个子目录的作用
components:写页面组件
assets:存放图片或者其他静态资源文件
store 管理vuex状态
layouts 页面结构复用
pages 创建根路由
vue ssr 工作原理:
ssr解决seo的问题。可以使内容快速展现。‘
nuxt.js升级为

Nuts.js01的更多相关文章
- Timus 2068. Game of Nuts 解题报告
1.题目描述: 2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still i ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- [LintCode] Nuts & Bolts Problem 螺栓螺母问题
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping ...
- Lintcode399 Nuts & Bolts Problem solution 题解
[题目描述] Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one m ...
- Lintcode: Nuts & Bolts Problem
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping ...
- How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views
How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views Ellen S ...
- UVA 10944 Nuts for nuts..
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&p ...
- Nuts & Bolts Problem
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping ...
- (转)Nuts and Bolts of Applying Deep Learning
Kevin Zakka's Blog About Nuts and Bolts of Applying Deep Learning Sep 26, 2016 This weekend was very ...
随机推荐
- springboot多数据源+jta事务管理配置
1.创建一个maven项目,导入相关配置: <?xml version="1.0" encoding="UTF-8"?> <project x ...
- CentOS本地挂载镜像
title date tags layout CentOS6.5 ISO镜像挂载,创建本地yum源 2018-08-23 Linux post 1.虚拟机挂载光盘选择相应的镜像 2.@#¥%--&am ...
- Python运维中常用的_脚本
前言 file是一个类,使用file('file_name', 'r+')这种方式打开文件,返回一个file对象,以写模式打开文件不存在则会被创建.但是更推荐使用内置函数open()来打开一个文件. ...
- 我是如何在四年时间里,从厨师转行为 Serverless 应用开发者
▎本文系译文,我的软件开发入行经历非常有趣 -- 我一开始其实是厨师. 作者:KieranMcCarthy 译者:Aceyclee 我在高中时就喜欢烹饪和烘焙,用不同食材的搭配去做出美味的食物,就像个 ...
- python三目运算和递归的小练习
应用前: ''' 递归的简单实现,输出i = 5的时候的结果 ''' def diGui(i = 0): i = i +1 if i >=5: return ("{0}大于等于5&qu ...
- [LC] 78. Subsets
Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solut ...
- 利用git上传文件到github
git add 文件名称/. "."代表全部 git commit -m -a git push -u origin master 推送到远程仓库 ---------------- ...
- 解密优秀博士成长史 ——微软亚洲研究院首届博士生学术论坛Panel讨论经验总结
--微软亚洲研究院首届博士生学术论坛Panel讨论经验总结" title="解密优秀博士成长史 --微软亚洲研究院首届博士生学术论坛Panel讨论经验总结"> 编者 ...
- 树剖裸题——BZOJ1036 树的统计
#include<cstring> #include<cmath> #include<algorithm> #include<cstdio> #defi ...
- considerate|considerable|content|Contact|Consult|deceived|
ADJ-GRADED 替人着想的;体贴的Someone who is considerate pays attention to the needs, wishes, or feelings of o ...