https://blog.csdn.net/zhanglongdream/article/details/67637518
https://www.cnblogs.com/wangyunhui/p/8178392.html
Vue是什么?
Vue.js(读音 /vjuː/, 类似于 view) 是一套构建用户界面的 渐进式框架。与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计。Vue 的核心库只关注视图层,并且非常容易学习,非常容易与其它库或已有项目整合。另一方面,Vue 完全有能力驱动采用单文件组件和 Vue 生态系统支持的库开发的复杂单页应用。
Vue.js 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件。
易用(已经会了HTML,CSS,JavaScript 即可轻松上手)、灵活(简单小巧的核心,渐进式技术栈,足以应付任何规模的应用)、性能(17kb min+gzip 运行大小、超快虚拟DOM、最省心的优化)、渐进式JavaScript 框架。
Vue.js 是我在2014年2月开源的一个前端开发库,通过简洁的 API 提供高效的数据绑定和灵活的组件系统。在前端纷繁复杂的生态中,Vue.js有幸受到一定程度的关注,目前在 GitHub上已经有快6000+的star。
vux github ui demo:https://github.com/airyland/vux
vant https://github.com/youzan/vant
Mint UI
项目主页:http://mint-ui.github.io/#!/zh-cn
demo:http://elemefe.github.io/mint-ui/#/
github地址:https://github.com/ElemeFE/mint-ui
中文文档地址:http://mint-ui.github.io/docs/#!/zh-cn
iview
iView 配套的工作流:https://github.com/icarusion/vue-vueRouter-webpack
github地址:https://github.com/iview/iview
官网:https://www.iviewui.com/
vue-mui
官网:http://mui.yaobieting.com/
github地址:https://github.com/creatshare/vue-mui
radon-ui
中文文档:https://luojilab.github.io/radon-ui/#!/
github:https://github.com/luojilab/radon-ui
antd vue
中文文档:http://okoala.github.io/vue-antd/#!/components
github:https://github.com/okoala/vue-antd
weex
社区:http://www.weex.help/
官网:http://weex-project.io/cn/
github:https://github.com/alibaba/weex
中文文档:http://www.weex.help/topic/57792770eb60516a48db5485
element(饿了么后台)
Element 是由饿了么UED设计、饿了么大前端开发的一套基于 Vue 2.0 的桌面端组件库。
官网:http://element.eleme.io/#/zh-CN
饿了么github:http://github.com/elemefe
N3
官网:https://n3-components.github.io/N3-components/
中文文档:https://n3-components.github.io/N3-components/component.html
英文文档:https://github.com/N3-components/N3-components
vuikit
github:https://github.com/vuikit/vuikit
英文文档:https://vuikit.js.org/#/
https://github.com/freedomdebug/dynamicRouter
手动存取 localStorage 的方式还可以做得更简便。那就是引入 vuex-persist 插件,它就是为 Vuex 持久化存储而生的一个插件。不需要你手动存取 storage ,而是直接将状态保存至 cookie 或者 localStorage 中。
使用方法
[codes=c#]
安装:npm install --save vuex-persist
导入:import VuexPersistence from 'vuex-persist'
创建一个对象:
const vuexLocal = new VuexPersistence({
storage: window.localStorage
})
安装进vuex插件:
const store = new Vuex.Store
state: { ... },
mutations: { ... },
actions: { ... },
plugins: [vuexLocal.plugin]
})
[/codes]
通过以上设置,在图3中各个页面之间跳转,如果刷新某个视图,数据并不会丢失,依然存在,并且不需要在每个 mutations 中手动存取 storage 。
vuex-persist 的详细属性-
属性 类型 描述
key string 将状态存储在存储中的键。默认: 'vuex'
storage Storage (Web API) 可传localStorage, sessionStorage, localforage 或者你自定义的存储对象. 接口必须要有get和set. 默认是: window.localStorage
saveState function (key, state[, storage]) 如果不使用存储,这个自定义函数将保存状态保存为持久性。
restoreState function (key[, storage]) => state 如果不使用存储,这个自定义函数处理从存储中检索状态
reducer function (state) => object 将状态减少到只需要保存的值。默认情况下,保存整个状态。
filter function (mutation) => boolean 突变筛选。看mutation.type并返回true,只有那些你想坚持写被触发。所有突变的默认返回值为true
modules string[] 要持久化的模块列表。
github:https://github.com/olado/doT
使用熟知的“Mustache”语法 (双大括号) 来嵌入数据,脚本会解析占位符
exp:
[codes=c#]
{{= }} for interpolation
{{ }} for evaluation
{{~ }} for array iteration
{{? }} for conditionals
{{! }} for interpolation with encoding
{{# }} for compile-time evaluation/includes and partials
{{## #}} for compile-time defines
[/codes]
PWA所倡导的一些核心技术特性有:
可以在主屏幕上创建图标
可以离线运行
可以利用后台线程与服务端通讯
对搜索引擎友好
响应式界面,支持各种类型的终端和屏幕
方便分享,用户可以方便地把URL地址分享出去
下面是个demo项目:https://github.com/freedomdebug/vuejs-pwa-demo1
最近在看element-ui的源码,发现了一个这样的属性:inject.遂查看官网provider/inject
provider/inject:简单的来说就是在父组件中通过provider来提供变量,然后在子组件中通过inject来注入变量。
需要注意的是这里不论子组件有多深,只要调用了inject那么就可以注入provider中的数据。而不是局限于只能从当前父组件的prop属性来获取数据。
下面我们来验证下猜想:
first:定义一个parent component
[CODES=C#]
[/CODES]
third 定义另一个子组件
[CODES=C#]
{{demo}}
[/CODES]
在2个子组件中我们使用jnject注入了provide提供的变量for,并将它提供给了data属性。
这里官网注明例子只工作在 Vue 2.2.1 或更高版本。低于这个版本时,注入的值会在 props 和 data 初始化之后得到。
运行之后看下结果
从上面这个例子可以看出,只要在父组件中调用了,那么在这个父组件生效的生命周期内,所有的子组件都可以调用inject来注入父组件中的值。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
1.github下载地址:https://github.com/vuejs/vue-devtools
2.下载好后进入vue-devtools-master工程 执行npm install ----->npm run build
npm最好换淘宝源
3.修改mainifest.json 中的persistent为true
步骤3没有设置会,,安装报错
[codes=c#]
ERROR in F:/java_workspace/vue-devtools-master/node_modules/_vue-loader@15.0.5@v
ue-loader/lib/loaders/stylePostLoader.js
一直报这个错误
[/codes]
