diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 467bf6a3..1ec5d421 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -41,82 +41,141 @@ module.exports = { editLinkText: '在 GitHub 上编辑此页', lastUpdated: '最后更新', nav: [ - { text: '指南', link: '/zh/guide/' }, - { text: '插件', link: '/zh/plugins/' }, - { text: '组件', link: '/zh/components/' }, + { + text: '学习', + items: [ + { text: '教程', link: '/zh/learn-guide/' }, + { text: '相关知识', link: '/zh/learn-knowledge/' } + ] + }, + { + text: '模块', + items: [ + { text: '组件', link: '/zh/sys-components/' }, + { text: '插件', link: '/zh/sys-plugins/' }, + { text: 'vuex', link: '/zh/sys-vuex/' }, + { text: '菜单', link: '/zh/sys-menu/' }, + { text: '路由', link: '/zh/sys-route/' }, + { text: '多页面', link: '/zh/sys-multi-page/' }, + { text: '数据持久化', link: '/zh/sys-db/' }, + { text: 'CSS 实用类', link: '/zh/sys-css/' }, + { text: 'JS Util', link: '/zh/sys-util/' }, + { text: 'cli3 和 webpack', link: '/zh/sys-cli3-webpack/' } + ] + }, + { + text: '生态', + items: [ + { text: 'D2 Admin start kit', link: '/zh/ecosystem-d2-admin-start-kit/' }, + { text: 'D2 Admin ICE', link: '/zh/ecosystem-d2-admin-ice/' }, + { text: 'D2 CRUD', link: '/zh/ecosystem-d2-crud/' }, + { text: 'D2 Ribbons', link: '/zh/ecosystem-d2-ribbons/' } + ] + }, { text: '文章', link: '/zh/article/' }, - { text: '其它', link: '/zh/others/' }, - { text: '预览', link: 'https://fairyever.gitee.io/d2-admin-preview/#/index' } + { + text: '其它', + items: [ + { text: '更新日志', link: '/zh/change-log/' }, + { text: '参与者名单', link: '/zh/collaborator/' }, + { text: '借鉴 D2Admin 的项目', link: '/zh/plagiarize/' }, + { + text: '交流', + items: [ + { text: '微信公众号', link: '/zh/communication-we/' }, + { text: '交流群', link: '/zh/communication-group-chat/' } + ] + }, + { + text: '关注我们', + items: [ + { text: '掘金', link: 'https://juejin.im/user/57a48b632e958a006691b946/posts' }, + { text: 'CSDN', link: 'https://blog.csdn.net/fairyever' }, + { text: 'segmentfault', link: 'https://segmentfault.com/blog/liyang-note-book' }, + { text: '知乎', link: 'https://www.zhihu.com/people/fairy-ever/activities' } + ] + }, + { + text: 'D2 在其它地方', + items: [ + { text: 'awesome-vue', link: 'https://github.com/vuejs/awesome-vue' }, + { text: 'ant design scaffolds', link: 'http://scaffold.ant.design/#/scaffolds/d2-admin' }, + { text: 'ice vue scaffold', link: 'https://alibaba.github.io/ice/scaffold?type=vue' }, + { text: 'awesomes.cn', link: 'https://www.awesomes.cn/repo/d2-projects/d2-admin' }, + { text: 'oschina.net', link: 'https://www.oschina.net/p/D2admin' }, + { text: 'ctolib.com', link: 'https://www.ctolib.com/FairyEver-d2-admin.html' } + ] + } + ] + }, + { text: '常见问题', link: '/zh/question/' } ], sidebar: { - '/zh/guide/': sideBarGuide('指南'), - '/zh/plugins/': sideBarPlugins('插件'), - '/zh/components/': sideBarComponents('组件'), - '/zh/article/': sideBarArticle('Cookbook', '版本更新'), - '/zh/others/': sideBarOthers('其它') + '/zh/learn-guide/': sideBarLearnGuide(), + '/zh/sys-components/': sideBarSysComponents(), + '/zh/sys-plugins/': sideBarSysPlugins(), + '/zh/article/': sideBarArticle('版本发布', 'Cookbook') } } } } } -function sideBarGuide (title) { +function sideBarLearnGuide () { return [ { - title, collapsable: false, children: [ '', - 'getting-started', - 'question', - 'plagiarize', - 'change-log' + 'getting-started' ] } ] } -function sideBarPlugins () { - return [ - '', - 'data-export', - 'data-import', - 'i18n', - 'mock', - 'vuex', - 'util' - ] -} - -function sideBarComponents (title) { +function sideBarSysComponents () { return [ { - title, collapsable: false, children: [ - '', - 'charts', - 'charts-new', 'container', - 'count-up', - 'highlight', - 'icon-select', - 'icon-svg', 'icon', - 'markdown' + 'icon-svg', + 'icon-select', + 'markdown', + 'highlight', + 'count-up', + 'charts' ] } ] } -function sideBarArticle (titleCookBook, titleUpdate) { +function sideBarSysPlugins () { return [ { - title: titleCookBook, + collapsable: false, + children: [ + 'data-export', + 'data-import', + 'i18n', + 'mock', + 'error', + 'log', + 'console' + ] + } + ] +} + +function sideBarArticle (titleUpdate, titleCookbook) { + return [ + { + title: titleCookbook, collapsable: false, children: [ 'cookbook/what-is-cookbook', - 'cookbook/combinable-questionnaire', + 'cookbook/combinable-questionnaire' ] }, { @@ -130,17 +189,4 @@ function sideBarArticle (titleCookBook, titleUpdate) { ] } ] -} - -function sideBarOthers (title) { - return [ - { - title, - collapsable: false, - children: [ - '', - 'css' - ] - } - ] -} +} \ No newline at end of file diff --git a/docs/zh/README.md b/docs/zh/README.md index 97821ba8..29643ebf 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -2,26 +2,19 @@ home: true heroImage: /logo@2x.png actionText: 快速上手 → -actionLink: /zh/guide/ +actionLink: /zh/learn-guide/ features: - title: Vue驱动 details: 享受 Vue + webpack 的开发体验,超快虚拟 DOM 和最省心的优化。 +- title: 强大的数据持久化方案 + details: 内部封装了多种数据持久化方式,您可以在数据持久化时区分用户,区分页面,甚至可以创建页面数据快照。 +- title: 模块化全局状态管理 + details: D2Admin 的系统管理为独立模块,在此模块内根据功能划分为十几个模块,每个模块都分工明确。 +- title: 贴心小工具 + details: 为您准备了实用的 JavaScript Util 以及 CSS 常用类。 - title: 丰富集成 - details: 已经为你准备好了很可能用到的插件和组件,有的来自第三方,有的专为 d2admin 设计。 + details: 已经为你准备好了很可能用到的插件和组件,专为 D2Admin 设计,或者来自第三方。 - title: ElementUI组件库 details: 集成完善且强大的 ElementUI,随意搭配使用任何 ElementUI 组件。 footer: MIT Licensed | Copyright © 2018-present FairyEver ---- - -``` -// 安装依赖 -npm i - -// 运行 -npm run dev - -// 打包 -npm run build -``` - -> 如果上述步骤出现错误,建议您升级 node 版本 > 8,如果有其它疑问请参考[常见问题](/zh/guide/question.html) \ No newline at end of file +--- \ No newline at end of file diff --git a/docs/zh/guide/change-log.md b/docs/zh/change-log/README.md similarity index 86% rename from docs/zh/guide/change-log.md rename to docs/zh/change-log/README.md index ae6eb9ad..b55a0f7f 100644 --- a/docs/zh/guide/change-log.md +++ b/docs/zh/change-log/README.md @@ -1,5 +1,31 @@ +--- +sidebar: auto +--- + # 更新日志 +## v1.2.0 + +* [ 新增 ] 全局状态管理模块化并且重新设计了 API +* [ 新增 ] 全新的数据持久化 API +* [ 新增 ] 文档重构 +* [ 新增 ] 菜单支持跳转到外部链接 +* [ 修改 ] bug 修复 + +## v1.1.11 + +* [ 修改 ] 优化 v1.1.10 的更新代码 +* [ 修改 ] 修正版本号 + +## v1.1.10 + +* [ 修改 ] 修复了多标签页使用右侧菜单关闭时的报错 + +## v1.1.9 + +* [ 新增 ] 优化了多标签页数据持久化取值逻辑,现在修改路由信息后,刷新页面时数据从持久化存储取值时会多经过一部数据处理,根据 name 字段匹配新的路由数据 +* [ 新增 ] `d2adminUtilDb2VuexByUuid` 和 `d2adminUtilDb2Vuex` 新增第三个参数: handleFunction,该参数可以设置一个数据处理的回调函数,如果设置了该回调函数,在从持久化存储中取值时,如果成功取值,数据会首先经过该函数处理最后赋值到 store + ## v1.1.8 * [ 新增 ] 增加了错误收集和日志收集功能 diff --git a/docs/zh/collaborator/README.md b/docs/zh/collaborator/README.md new file mode 100644 index 00000000..ea56aef7 --- /dev/null +++ b/docs/zh/collaborator/README.md @@ -0,0 +1,13 @@ +--- +sidebar: auto +--- + +# 参与者名单 + +| avatar | ID | Github | +| :---: | --- | --- | +| | FairyEver | [https://github.com/FairyEver](https://github.com/FairyEver) | +| | sunhaoxiang | [https://github.com/sunhaoxiang](https://github.com/sunhaoxiang) | +| | namklaw | [https://github.com/namklaw](https://github.com/namklaw) | +| | mokeyjay | [https://github.com/mokeyjay](https://github.com/mokeyjay) | +| | Aysnine | [https://github.com/Aysnine](https://github.com/Aysnine) | \ No newline at end of file diff --git a/docs/zh/communication-group-chat/README.md b/docs/zh/communication-group-chat/README.md new file mode 100644 index 00000000..43b63253 --- /dev/null +++ b/docs/zh/communication-group-chat/README.md @@ -0,0 +1,6 @@ +# 交流群 + +| QQ 交流群 | 作者微信 | +| --- | --- | +| | | +| QQ 群比交流比较活跃 建议加入 | 微信群大于 100 人后需要群主邀请加入 | \ No newline at end of file diff --git a/docs/zh/communication-group-chat/image/qq.jpg.REMOVED.git-id b/docs/zh/communication-group-chat/image/qq.jpg.REMOVED.git-id new file mode 100644 index 00000000..a957a237 --- /dev/null +++ b/docs/zh/communication-group-chat/image/qq.jpg.REMOVED.git-id @@ -0,0 +1 @@ +b27de32f6832b50dc5b8b1dc613060a81f88a8e9 \ No newline at end of file diff --git a/docs/zh/communication-group-chat/image/we.jpg.REMOVED.git-id b/docs/zh/communication-group-chat/image/we.jpg.REMOVED.git-id new file mode 100644 index 00000000..b485920f --- /dev/null +++ b/docs/zh/communication-group-chat/image/we.jpg.REMOVED.git-id @@ -0,0 +1 @@ +12bb778e8779f32a46ee756e6dbb890024b40f5d \ No newline at end of file diff --git a/docs/zh/communication-we/README.md b/docs/zh/communication-we/README.md new file mode 100644 index 00000000..6fe4990b --- /dev/null +++ b/docs/zh/communication-we/README.md @@ -0,0 +1,3 @@ +# 微信公众号 + + \ No newline at end of file diff --git a/docs/zh/communication-we/image/qr@2x.png.REMOVED.git-id b/docs/zh/communication-we/image/qr@2x.png.REMOVED.git-id new file mode 100644 index 00000000..5748278d --- /dev/null +++ b/docs/zh/communication-we/image/qr@2x.png.REMOVED.git-id @@ -0,0 +1 @@ +2ef12d88b2011063784c37f8b8490336503a5f88 \ No newline at end of file diff --git a/docs/zh/components/charts.md b/docs/zh/components/charts.md deleted file mode 100644 index 024f7039..00000000 --- a/docs/zh/components/charts.md +++ /dev/null @@ -1,76 +0,0 @@ -# 图表 [ G2 ] 旧 - -::: tip -此文档仅对 `1.1.0` 及其以下版本有效,`1.1.1` 开始变更了图表库 -::: - -## 介绍 - -D2Admin 集成了由蚂蚁金服出品的 **G2** 图表库 - -## 实现方式 - -`src/components/charts/register.js` 为注册图表组件的文件 - -`src/components/charts/G2` 为图表组件存放位置 - -`src/components/charts/G2/mixins/G2.js` 是图表最主要的文件,这是一个所有的图表组件都会使用的 mixin,这个 mixin 主要有以下用途 - - - 将 G2 和 DataSet 绑定到 data 上,方便组件使用,省去重复 `import G2 from '@antv/g2'` 等 - - 将 [G2 Chart类](http://antv.alipay.com/zh-cn/g2/3.x/api/chart.html#_Chart) 的属性全部暴露为 Vue 组件参数,这些参数会在初始化图表时用到 - - 提供了额外的设置参数,比如自动高度,自动初始化,初始化延时 - - 关闭 G2 的体验改进计划打点请求 - - data 上的 chart 对象 - - 自动初始化(或者不初始化)图表 - - `creatChart` 方法,根据参数设置生成 data 上的 chart 对象 - - `resize` 方法 - -在图表组件中使用这个 mixin 示例 - -``` vue - - - -``` - -上面的代码段展示了如何使用 mixin 快速制作一个图表组件,只需根据某个图表的个性化需要,在组件中重新定义 `init` 和 `changeData` 方法即可 - -你可以修改这个 mixin 去实现更多的功能,同时影响所有的图表组件 - -::: tip -这只仅仅是作者个人对于图表封装的一个实现思路 -::: - -## 为什么没有选择其他产品 - -G2 完全可以胜任一般的后台界面报表图表需求,而且官网文档清晰友好 - -如果你需要更酷炫的图表,也完全可以剔除集成的库,换用 百度的[echarts](http://echarts.baidu.com/) 或者超级强大的 [d3.js](https://d3js.org/) \ No newline at end of file diff --git a/docs/zh/components/container.md.REMOVED.git-id b/docs/zh/components/container.md.REMOVED.git-id deleted file mode 100644 index 2712e40f..00000000 --- a/docs/zh/components/container.md.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -be315dc4b20db4a72f9543b102c601365693b67d \ No newline at end of file diff --git a/docs/zh/ecosystem-d2-admin-ice/README.md b/docs/zh/ecosystem-d2-admin-ice/README.md new file mode 100644 index 00000000..0de0f0d3 --- /dev/null +++ b/docs/zh/ecosystem-d2-admin-ice/README.md @@ -0,0 +1,9 @@ +--- +sidebar: auto +--- + +# D2Admin ICE + +项目地址 [https://github.com/d2-projects/d2-admin-ice](https://github.com/d2-projects/d2-admin-ice) + +使用方法见 [https://juejin.im/post/5b6349716fb9a04f834669d6](https://juejin.im/post/5b6349716fb9a04f834669d6) \ No newline at end of file diff --git a/docs/zh/ecosystem-d2-admin-start-kit/README.md b/docs/zh/ecosystem-d2-admin-start-kit/README.md new file mode 100644 index 00000000..b0f62e36 --- /dev/null +++ b/docs/zh/ecosystem-d2-admin-start-kit/README.md @@ -0,0 +1,16 @@ +--- +sidebar: auto +--- + +# D2Admin 项目起始模板 + +项目地址 [https://github.com/d2-projects/d2-admin-start-kit](https://github.com/d2-projects/d2-admin-start-kit) + +只保留了基础功能,例如 + +* 主题系统 +* 登陆和注销 +* 数据持久化 +* 多标签页 +* 菜单和路由逻辑 +* ... \ No newline at end of file diff --git a/docs/zh/ecosystem-d2-crud/README.md b/docs/zh/ecosystem-d2-crud/README.md new file mode 100644 index 00000000..21b8b712 --- /dev/null +++ b/docs/zh/ecosystem-d2-crud/README.md @@ -0,0 +1,7 @@ +--- +sidebar: auto +--- + +# D2 CRUD + +comming soon \ No newline at end of file diff --git a/docs/zh/ecosystem-d2-ribbons/README.md b/docs/zh/ecosystem-d2-ribbons/README.md new file mode 100644 index 00000000..1bfcf683 --- /dev/null +++ b/docs/zh/ecosystem-d2-ribbons/README.md @@ -0,0 +1,91 @@ +--- +sidebar: auto +--- + +![banner](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/banner%402x.png) + +D2 Ribbons 是一套为开发者准备的开源社区绶带资源,你你可以下载图片到你的项目中使用或者直接使用仓库资源链接。 + +项目地址 [https://github.com/d2-projects/d2-ribbons](https://github.com/d2-projects/d2-ribbons) + +## Features + +* 扁平化风格 +* Github Gitlab Gitee 三套图标 +* 六色主题 +* 半透明 / 不透明样式 +* 文字 / 图标样式 +* @2x 资源 +* 统一尺寸(150 x 150 / 300 x 300 @2x) +* 附带 Github 经典样式的绶带 + +## Story + +> 我想了想究竟是预览放在前面还是介绍放在前面,最后我觉得应该先写东西,因为预览图太多了 + +萌生做这么一个项目是从做 [D2Admin](https://github.com/d2-projects/d2-admin) 的时候,我想给我的项目页面角落加一个 “Fork me on github”,然后我就找了几个开源项目想看看他们用的是什么图片,都不很理想,后来找到了 Github 官方的 ribbons,但是和我的项目风格不是很搭配,Github 官方的 ribbons 还是以前的拟物风格,我希望有一个比较“扁平化”的绶带放在上面,于是我就临时画了一个放上去了,长这个样子: + +![Snip20180711_32](http://fairyever.qiniudn.com/Snip20180711_32.png) + +于是之后我就画了大概半天的事件,画了一套 ribbons 给以后用,自己用,也希望大家能用到,不仅有 github,还有 gitlab 和码云的版本,暂时只做了这些,以后有好的想法了再添加。 + +![Snip20180711_27](http://fairyever.qiniudn.com/Snip20180711_27.png) +![Snip20180711_29](http://fairyever.qiniudn.com/Snip20180711_29.png) + +> 所有的东西都出自一个程序员之手,没有经过专业的设计学习,请大家觉得丑的话轻喷 + +sketch 是我最喜欢的设计软件,推荐给大家。 + +在设计这套图片的时候我也尽量发挥了 sketch 的特性,比如颜色配置,公用样式,symbol等很好用的功能,这些都可以达到改一处动全部和事半功倍的效果。 + +下面放上效果预览: + +## Preview + +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-text-github%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/github/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/github/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-text-gitlab%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/gitlab/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/gitlab/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-text-gitee%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/gitee/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-text/gitee/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-icon-github%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/github/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/github/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-icon-gitlab%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/gitlab/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/gitlab/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-opacity-icon-gitee%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/gitee/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-opacity-icon/gitee/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-text-github%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/github/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/github/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-text-gitlab%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/gitlab/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/gitlab/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-text-gitee%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/gitee/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-text/gitee/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-icon-github%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/github/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/github/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-icon-gitlab%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/gitlab/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/gitlab/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-flat-icon-gitee%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/gitee/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/flat-icon/gitee/right%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/doc/ribbons-classic-github%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/classic/github/left%402x.png) +![](https://raw.githubusercontent.com/d2-projects/d2-ribbons/master/priview/classic/github/right%402x.png) + +## How to use + +没有固定的使用方法,都是图片,你可以下载下来用到你的项目里,或者直接使用本仓库的图片链接。每款绶带都有 @2x 版本 + +后续还会陆续更新其它的图片资源。 + +其实不论 github 还是码云,官方提供的都有类似的 ribbon,看个人喜好选择 D2 还是官方就好 \ No newline at end of file diff --git a/docs/zh/guide/image/join@2x.png.REMOVED.git-id b/docs/zh/guide/image/join@2x.png.REMOVED.git-id deleted file mode 100644 index 597c865a..00000000 --- a/docs/zh/guide/image/join@2x.png.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f7a47389e6c0773e9d218227678ebb8850ea87e8 \ No newline at end of file diff --git a/docs/zh/guide/image/preview@2x.png.REMOVED.git-id b/docs/zh/guide/image/preview@2x.png.REMOVED.git-id deleted file mode 100644 index 7b05e991..00000000 --- a/docs/zh/guide/image/preview@2x.png.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -27e431bd9e4752dd51fe827a1281d606bd7bdf07 \ No newline at end of file diff --git a/docs/zh/guide/question.md.REMOVED.git-id b/docs/zh/guide/question.md.REMOVED.git-id deleted file mode 100644 index ae335046..00000000 --- a/docs/zh/guide/question.md.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -60313ac9834bcc8639358f7a6672dcfb18a3ec40 \ No newline at end of file diff --git a/docs/zh/guide/README.md b/docs/zh/learn-guide/README.md similarity index 56% rename from docs/zh/guide/README.md rename to docs/zh/learn-guide/README.md index 5260c360..308420d3 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/learn-guide/README.md @@ -7,9 +7,7 @@ D2Admin 是一个开源的管理系统前端集成方案 -本项目仓库在 Github 和 Gitee 同步发布 - -[中文文档](http://d2admin.fairyever.com/zh/) +![](http://fairyever.qiniudn.com/20180821142809.png) **完整版** @@ -23,23 +21,11 @@ D2Admin 是一个开源的管理系统前端集成方案 [码云仓库](https://gitee.com/fairyever/d2-admin-start-kit) | [预览地址](https://fairyever.gitee.io/d2-admin-start-kit-preview/#/index) -![preview](./image/preview@2x.png) +**飞冰物料** -D2Admin 完整版集成了很多的插件和组件,首次加载会占用很多的时间,所以加入了首屏加载动画。 - -如果您欣赏 D2Admin 的设计风格,希望基于它开发您的管理系统,**建议使用 [d2-admin-start-kit 简化模板](https://github.com/d2-projects/d2-admin-start-kit)**,简化版模板保留了所有的系统功能,包括登陆注销,主题切换,图标,数据持久化等。其它不必要的组件和插件您可以参照 D2Admin 完整版自行加入。 - -如果您执意在完整版基础上开发,请您在发布之前一定要删除没有用到的代码,比如项目没有用到图表、示例、插件组件。 - -D2Admin 是完全开源免费的管理系统集成方案,由 [FairyEver](https://github.com/FairyEver) 工作之余完完成(希望您看到这里,可以移步 [Github](https://github.com/d2-projects/d2-admin) 点个 star 支持我),如果你也一样喜欢前端开发,欢迎加入我们的讨论/学习群,群内可以`提问答疑`,`分享学习资料`。 - -![preview](./image/join@2x.png) - -::: tip Thanks -D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日正式发布,39天时间 star 突破 1k ,在此对所有的 D2Admin 支持者表示感谢,项目将会保持更新,如果你有想法、建议、或者问题欢迎加群讨论 - -—— 2018年7月5日 -::: +[D2Admin ICE](https://alibaba.github.io/ice/scaffold?type=vue) | +[介绍](https://juejin.im/post/5b6349716fb9a04f834669d6) | +[预览地址](https://fairyever.gitee.io/d2-admin-ice-preview) ## 功能 @@ -47,7 +33,6 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日 * 首屏加载等待动画 避免首次加载白屏尴尬 * 简约主题 * 每个插件和组件都配有介绍文档 -* 图片资源 sketch 源文件( 可以在这个文件内重新生成所有图片资源 ) * 登陆和注销 * 根据路由自动生成菜单 * 可折叠侧边栏 @@ -60,9 +45,8 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日 * 图标选择器(组件) * 自动引入下载的 SVG 图标 * 前端假数据支持( mock ) -* 集成蚂蚁金服出品的 G2 图表 -* 图表自适应可拖拽大小的卡片容器(示例) * 简化剪贴板操作 +* 集成图表插件 * 时间日期计算工具 * 导入 Excel ( xlsx 格式 + csv 格式 ) * 数据导出 Excel ( xlsx 格式 + csv 格式 ) @@ -80,7 +64,6 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日 * 自定义滚动条和滚动控制 * 内置5种主题 * 公用样式抽离,方便的主题定制 -* 支持百万级数据量的表格组件 * 打包后随意目录部署(已经做好兼容设置) * 支持临时菜单配置 * 提供“试验台”功能 方便展示系统功能调用方法 `1.1.4 +` @@ -88,13 +71,16 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日 * 美化滚动条 `1.1.4 +` * json view `1.1.4 +` * cookie 封装 `1.1.5 +` -* 本地持久化存储封装,可根据用户区分存储 `1.1.5 +` * 多标签页全局控制 API `1.1.5 +` * 菜单全局控制 API `1.1.5 +` +* 多标签页关闭控制支持右键菜单 `1.1.10 +` +* 模块化全局状态管理 `1.2.0 +` +* 多种数据持久化方式:区分用户,区分路由,页面数据快照功能 `1.2.0 +` +* 支持跳出外部链接的菜单系统 `1.2.0 +` ## 目录结构 -``` +
 ├─ dev
 │  └─ snippets 帮助开发的代码片段
 ├─ docs 文档
@@ -112,7 +98,8 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日
 │  ├─ router 路由
 │  ├─ store 全局状态
 │  ├─ App.vue
-│  └─ main.js
+│  ├─ main.js
+│  └─ setting.js 设置
 ├─ tests 单元测试
 ├─ .env 环境变量
 ├─ .env.development 环境变量 开发环境
@@ -126,31 +113,14 @@ D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日
 ├─ jest.config.js
 ├─ package.json
 └─ vue.config.js 配置文件
-```
+
-## 获取代码 +## Thanks -有两种方式可以获得 D2Admin 的代码 +D2Admin 创建于2018年1月14日零点51分,四个月后在2018年5月26日正式发布,39天时间 star 突破 1k ,在此对所有的 D2Admin 支持者表示感谢,项目将会保持更新,如果你有想法、建议、或者问题欢迎加群讨论 -* 在 [releases](https://github.com/d2-projects/d2-admin/releases) 页面下载最新的发行版。发行版一般是完成了某个大升级或者修复重要 bug 后发布的压缩包,你可以下载下来直接使用 +—— 2018年7月5日 -* Fork 仓库到你的 github 然后克隆到本地,然后使用 master 分支继续你的开发。这种方式得到的是最新的代码,但是会有未完成的新功能。**不建议使用这种方式** +star 破 2k -* 由于 github 访问较慢,推荐前往码云仓库下载 [gitee.com/fairyever/d2-admin](https://gitee.com/fairyever/d2-admin),码云上的仓库**在每次发布版本或者修复 bug 才会更新**,所以如果你选择此方法,请直接 fork 仓库并克隆到本地 - -> 码云的仓库由 github 同步,但是发行版和标签同步有一些问题,所以推荐直接 fork 仓库 - -## 使用 - -``` -// 安装依赖 -npm i - -// 运行 -npm run dev - -// 打包 -npm run build -``` - -> 如果上述步骤出现错误,建议您升级 node 版本 > 8,如果有其它疑问请参考[常见问题](/zh/guide/question.html) \ No newline at end of file +—— 2018年8月7日 \ No newline at end of file diff --git a/docs/zh/guide/getting-started.md b/docs/zh/learn-guide/getting-started.md similarity index 68% rename from docs/zh/guide/getting-started.md rename to docs/zh/learn-guide/getting-started.md index a70e1dc9..3b5a1727 100644 --- a/docs/zh/guide/getting-started.md +++ b/docs/zh/learn-guide/getting-started.md @@ -4,28 +4,6 @@ ![](http://fairyever.qiniudn.com/20180729102354.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) -## 前置知识 - -使用 D2Admin 首先组要有以下前置知识: - -* 首先需要熟悉 web 开发基础三样:[HTML CSS JavaScript](http://www.w3school.com.cn/) -* 会使用 [vue.js](https://cn.vuejs.org/) - -如果您了解以下技术,在使用本项目进行您的开发时会更加得心应手: - -* [ES6](http://es6.ruanyifeng.com/) -* [sass](https://www.sass.hk/guide/) - -## 准备 - -在上手之前,建议您先大致浏览以下章节,对整个系统有大致了解: - -* 每个页面最基础的构成部分:[页面容器](../components/container.md) -* 一些会用到的全局数据和方法:[VUEX 实用工具](../plugins/vuex.md) -* 一些会用到的公用方法:[Util 实用工具](../plugins/util.md) - -如果想了解更多 D2Admin 相关的教程和更新文章,可以参阅 [文章](../article/) - ## 下载项目 * 完整版仓库 [Github](https://github.com/d2-projects/d2-admin) | [码云](https://gitee.com/fairyever/d2-admin) @@ -60,7 +38,7 @@ 安装完毕后检查版本(最好使用 node 8 版本)。 -``` sh +``` node -v v8.11.1 npm -v @@ -77,13 +55,13 @@ npm -v 安装: -``` sh +``` npm install -g nrm ``` 查看所有可用源: -``` sh +``` nrm ls * npm ----- https://registry.npmjs.org/ cnpm ---- http://r.cnpmjs.org/ @@ -95,7 +73,7 @@ nrm ls 切换源: -``` sh +``` nrm use taobao ``` @@ -103,7 +81,7 @@ nrm use taobao 安装: -``` sh +``` npm install -g cnpm --registry=https://registry.npm.taobao.org ``` @@ -111,7 +89,7 @@ npm install -g cnpm --registry=https://registry.npm.taobao.org 将终端切换到项目目录之后安装依赖: -``` sh +``` npm i ``` @@ -121,19 +99,19 @@ npm i 在项目目录内启动项目: -``` sh +``` npm run dev ``` 或者使用: -``` sh +``` npm start ``` 也可以使用 cli3 新推荐的命令: -``` sh +``` npm run serve ``` @@ -161,7 +139,7 @@ npm run serve ``` -上面的代码生成了一个带有 header 和 footer 的页面,页面内容只有一句话,如果您好奇为什么这么写,可以参考 [页面容器](../components/container.md) +上面的代码生成了一个带有 header 和 footer 的页面,页面内容只有一句话,如果您好奇为什么这么写,可以参考 [页面容器](../sys-components/container.md) ![](http://fairyever.qiniudn.com/20180729095919.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) @@ -266,47 +244,3 @@ export default [ ![](http://fairyever.qiniudn.com/20180729101708.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) 上述教程只是介绍了 D2Admin 的冰山一角,更多的配置项和组件文档请查阅本文档其它板块。 - -如果您有疑问,请加 QQ 群 **806395827** 反馈。 - -## 资源 - -下面是一些在开发过程会用到的文档,列举在这里方便大家快速查看: - -组件库: - -* [element-ui](http://element.eleme.io/#/zh-CN/component/quickstart) - -项目基础: - -| 名称 | 介绍 | -| --- | --- | -| [vue.js](https://cn.vuejs.org/v2/guide/) | 框架基础 | -| [vuex](https://vuex.vuejs.org/zh/guide/) | 全局状态管理 | -| [vue-router](https://router.vuejs.org/zh/guide/) | 路由控制 | -| [sass](https://www.sass.hk/guide/) | CSS 预处理语言 | - -脚手架: - -| 名称 | 介绍 | -| --- | --- | -| [vue-cli3](https://github.com/vuejs/vue-docs-zh-cn/tree/master/vue-cli) | 项目脚手架 | -| [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain) | vue-cli3 中 webpack 的配置语法 | - -插件: - -| 名称 | 介绍 | -| --- | --- | -| [lodash](https://lodash.com/docs/4.17.10) | 一致性、模块化、高性能的 JavaScript 实用工具库 | -| [axios](https://github.com/axios/axios) | 最流行的网络请求库 | -| [better-scroll](https://github.com/ustbhuangyi/better-scroll) | [d2-container](../components/container.md) 的自定义滚动条依赖 | -| [dayjs](https://github.com/iamkun/dayjs) | 日期处理库 | -| [v-charts](https://v-charts.js.org/#/props) | vue 版本的 echarts 由饿了么开发 | -| [echarts](http://echarts.baidu.com/index.html) | v-charts 的核心 | -| [lowdb](https://github.com/typicode/lowdb) | D2Admin 操作本地数据的依赖 | -| [mockjs](https://github.com/nuysoft/Mock/wiki) | 模拟请求依赖 | -| [vue-i18n](https://kazupon.github.io/vue-i18n/guide/started.html) | 多国语依赖 | -| [vue-grid-layout](https://github.com/jbaysolutions/vue-grid-layout) | 网格布局组件 | -| [vue-splitpane](https://www.npmjs.com/package/vue-splitpane) | 切分布局组件 | - -上面只是一些猜您会用到的链接,还有一些项目中用到但是这里没有列举的,如果您觉得有必要,可以提 pr 修改本篇文档。 \ No newline at end of file diff --git a/docs/zh/learn-knowledge/README.md b/docs/zh/learn-knowledge/README.md new file mode 100644 index 00000000..6200b009 --- /dev/null +++ b/docs/zh/learn-knowledge/README.md @@ -0,0 +1,57 @@ +--- +sidebar: auto +--- + +# 相关知识 + +使用 D2Admin 首先组要有以下前置知识: + +* 首先需要熟悉 web 开发基础三样:[HTML CSS JavaScript](http://www.w3school.com.cn/) +* 会使用 [vue.js](https://cn.vuejs.org/) + +如果您了解以下技术,在使用本项目进行您的开发时会更加得心应手: + +* [ES6](http://es6.ruanyifeng.com/) +* [sass](https://www.sass.hk/guide/) + +## 资源 + +下面是一些在开发过程会用到的文档,列举在这里方便大家快速查看: + +组件库: + +* [element-ui](http://element.eleme.io/#/zh-CN/component/quickstart) + +项目基础: + +| 名称 | 介绍 | +| --- | --- | +| [vue.js](https://cn.vuejs.org/v2/guide/) | 框架基础 | +| [vuex](https://vuex.vuejs.org/zh/guide/) | 全局状态管理 | +| [vue-router](https://router.vuejs.org/zh/guide/) | 路由控制 | +| [sass](https://www.sass.hk/guide/) | CSS 预处理语言 | + +脚手架: + +| 名称 | 介绍 | +| --- | --- | +| [vue-cli3](https://cli.vuejs.org/zh/) | 项目脚手架 | +| [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain) | vue-cli3 中 webpack 的配置语法 | + +插件: + +| 名称 | 介绍 | +| --- | --- | +| [lodash](https://lodash.com/docs/4.17.10) | 一致性、模块化、高性能的 JavaScript 实用工具库 | +| [axios](https://github.com/axios/axios) | 最流行的网络请求库 | +| [better-scroll](https://github.com/ustbhuangyi/better-scroll) | [d2-container](../sys-components/container.md) 的自定义滚动条依赖 | +| [dayjs](https://github.com/iamkun/dayjs) | 日期处理库 | +| [v-charts](https://v-charts.js.org/#/props) | vue 版本的 echarts 由饿了么开发 | +| [echarts](http://echarts.baidu.com/index.html) | v-charts 的核心 | +| [lowdb](https://github.com/typicode/lowdb) | D2Admin 操作本地数据的依赖 | +| [mockjs](https://github.com/nuysoft/Mock/wiki) | 模拟请求依赖 | +| [vue-i18n](https://kazupon.github.io/vue-i18n/guide/started.html) | 多国语依赖 | +| [vue-grid-layout](https://github.com/jbaysolutions/vue-grid-layout) | 网格布局组件 | +| [vue-splitpane](https://www.npmjs.com/package/vue-splitpane) | 切分布局组件 | + +上面只是一些猜您会用到的链接,还有一些项目中用到但是这里没有列举的,如果您觉得有必要,可以提 pr 修改本篇文档。 \ No newline at end of file diff --git a/docs/zh/others/README.md b/docs/zh/others/README.md deleted file mode 100644 index 7fd6cd21..00000000 --- a/docs/zh/others/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# 其它 - -这里主要是介绍一些其它的信息 \ No newline at end of file diff --git a/docs/zh/guide/plagiarize.md b/docs/zh/plagiarize/README.md similarity index 99% rename from docs/zh/guide/plagiarize.md rename to docs/zh/plagiarize/README.md index 28c4a3db..fe7ca3e0 100644 --- a/docs/zh/guide/plagiarize.md +++ b/docs/zh/plagiarize/README.md @@ -1,5 +1,5 @@ --- -sidebarDepth: 3 +sidebar: auto --- # 借鉴 D2Admin 的项目 diff --git a/docs/zh/plugins/vuex.md.REMOVED.git-id b/docs/zh/plugins/vuex.md.REMOVED.git-id deleted file mode 100644 index 4c8311c7..00000000 --- a/docs/zh/plugins/vuex.md.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -250e779feddcc8e47751f1920ce3a49e0997740e \ No newline at end of file diff --git a/docs/zh/question/README.md.REMOVED.git-id b/docs/zh/question/README.md.REMOVED.git-id new file mode 100644 index 00000000..77fc82ad --- /dev/null +++ b/docs/zh/question/README.md.REMOVED.git-id @@ -0,0 +1 @@ +99c8b3f602498f3dacc3b8503d8dfad58e47430b \ No newline at end of file diff --git a/docs/zh/sys-cli3-webpack/README.md.REMOVED.git-id b/docs/zh/sys-cli3-webpack/README.md.REMOVED.git-id new file mode 100644 index 00000000..021f3b48 --- /dev/null +++ b/docs/zh/sys-cli3-webpack/README.md.REMOVED.git-id @@ -0,0 +1 @@ +1ad656c02671d6f1ab2e1bb10adfd45f48f96abc \ No newline at end of file diff --git a/docs/zh/components/README.md b/docs/zh/sys-components/README.md similarity index 91% rename from docs/zh/components/README.md rename to docs/zh/sys-components/README.md index 2fd73b8a..a890eb4f 100644 --- a/docs/zh/components/README.md +++ b/docs/zh/sys-components/README.md @@ -1,3 +1,3 @@ -# 组件概述 +# 组件 d2-admin(以下简称 d2admin)封装(或者集成第三方)了一些组件,方便开发者进行开发,具体组件文档请从左侧列表进入 \ No newline at end of file diff --git a/docs/zh/components/charts-new.md b/docs/zh/sys-components/charts.md similarity index 96% rename from docs/zh/components/charts-new.md rename to docs/zh/sys-components/charts.md index 7e423905..7c77cd9d 100644 --- a/docs/zh/components/charts-new.md +++ b/docs/zh/sys-components/charts.md @@ -1,4 +1,6 @@ -# 图表 [ v-charts ] 新 +# v-charts + +图表组件 ::: tip `1.1.0` 版本使用的是 `G2` 图表库,`1.1.3` 开始使用 `v-charts` diff --git a/docs/zh/sys-components/container.md.REMOVED.git-id b/docs/zh/sys-components/container.md.REMOVED.git-id new file mode 100644 index 00000000..3237b58a --- /dev/null +++ b/docs/zh/sys-components/container.md.REMOVED.git-id @@ -0,0 +1 @@ +a9e6a61590987cd12d1cdfbc28bdf44fae14da06 \ No newline at end of file diff --git a/docs/zh/components/count-up.md b/docs/zh/sys-components/count-up.md similarity index 95% rename from docs/zh/components/count-up.md rename to docs/zh/sys-components/count-up.md index a8f1844b..7586cc29 100644 --- a/docs/zh/components/count-up.md +++ b/docs/zh/sys-components/count-up.md @@ -1,4 +1,6 @@ -# 数字动画 +# d2-count-up + +数字动画组件 ## 参数 diff --git a/docs/zh/components/highlight.md b/docs/zh/sys-components/highlight.md similarity index 93% rename from docs/zh/components/highlight.md rename to docs/zh/sys-components/highlight.md index f8830d31..39bc3dc5 100644 --- a/docs/zh/components/highlight.md +++ b/docs/zh/sys-components/highlight.md @@ -1,4 +1,6 @@ -# 代码高亮 +# d2-highlight + +代码高亮显示组件 ## 参数 diff --git a/docs/zh/components/icon-select.md b/docs/zh/sys-components/icon-select.md similarity index 93% rename from docs/zh/components/icon-select.md rename to docs/zh/sys-components/icon-select.md index c44e6c8f..922d856f 100644 --- a/docs/zh/components/icon-select.md +++ b/docs/zh/sys-components/icon-select.md @@ -1,4 +1,6 @@ -# 图标 - 选择器 +# d2-icon-select + +图标选择器组件 ## 参数 diff --git a/docs/zh/components/icon-svg.md b/docs/zh/sys-components/icon-svg.md similarity index 97% rename from docs/zh/components/icon-svg.md rename to docs/zh/sys-components/icon-svg.md index 2bbdd0d5..972baf84 100644 --- a/docs/zh/components/icon-svg.md +++ b/docs/zh/sys-components/icon-svg.md @@ -1,4 +1,6 @@ -# 图标 - SVG +# d2-icon-svg + +SVG 图标组件 ## 参数 diff --git a/docs/zh/components/icon.md b/docs/zh/sys-components/icon.md similarity index 97% rename from docs/zh/components/icon.md rename to docs/zh/sys-components/icon.md index aae2eab4..8c946d5b 100644 --- a/docs/zh/components/icon.md +++ b/docs/zh/sys-components/icon.md @@ -1,4 +1,6 @@ -# 图标 +# d2-icon + +图标组件 ## 参数 diff --git a/docs/zh/components/image/baiduyun.png.REMOVED.git-id b/docs/zh/sys-components/image/baiduyun.png.REMOVED.git-id similarity index 100% rename from docs/zh/components/image/baiduyun.png.REMOVED.git-id rename to docs/zh/sys-components/image/baiduyun.png.REMOVED.git-id diff --git a/docs/zh/components/markdown.md b/docs/zh/sys-components/markdown.md similarity index 97% rename from docs/zh/components/markdown.md rename to docs/zh/sys-components/markdown.md index cb8af8b1..32646d76 100644 --- a/docs/zh/components/markdown.md +++ b/docs/zh/sys-components/markdown.md @@ -1,4 +1,6 @@ -# markdown 渲染器 +# d2-markdown + +markdown 渲染器组件 ## 参数 diff --git a/docs/zh/others/css.md b/docs/zh/sys-css/README.md similarity index 95% rename from docs/zh/others/css.md rename to docs/zh/sys-css/README.md index 1ca48b9a..443f8b92 100644 --- a/docs/zh/others/css.md +++ b/docs/zh/sys-css/README.md @@ -1,12 +1,16 @@ -# CSS 工具类 +--- +sidebar: auto +--- + +# CSS 实用类 ## 样式 | 类名 | 效果 | | --- | --- | -| `.d2-card` | 将该 class 添加至 el-card 组件上使其有跟随主题变化的样式 | +| `.d2-card` | 使 el-card 组件样式跟随主题变化 | -`.d2-card` 示例 +* `.d2-card` 示例 ``` vue diff --git a/docs/zh/sys-db/README.md.REMOVED.git-id b/docs/zh/sys-db/README.md.REMOVED.git-id new file mode 100644 index 00000000..22d06029 --- /dev/null +++ b/docs/zh/sys-db/README.md.REMOVED.git-id @@ -0,0 +1 @@ +f859e2952f21e7ee100da4dc863f96f721bb439c \ No newline at end of file diff --git a/docs/zh/sys-menu/README.md b/docs/zh/sys-menu/README.md new file mode 100644 index 00000000..f5468e3c --- /dev/null +++ b/docs/zh/sys-menu/README.md @@ -0,0 +1,59 @@ +--- +sidebar: auto +--- + +# 菜单 + +D2Admin 的顶栏菜单和侧边栏菜单相互独立互不影响。 + +## 数据源 + +顶栏数据使用 `$store.state.d2admin.menu.header` 作为数据源。[API](../sys-vuex/#state-header) + +侧栏数据使用 `$store.state.d2admin.menu.aside` 作为数据源。[API](../sys-vuex/#state-aside) + +## 设置菜单 + +顶栏使用 `$store.commit('d2admin/menu/headerSet', menu)` 更新数据源。[API](../sys-vuex/#mutations-headerset) + +侧栏使用 `$store.commit('d2admin/menu/asideSet', menu)` 更新数据源。[API](../sys-vuex/#mutations-asideset) + +menu 的数据格式见 [menu 数据格式](../sys-vuex/#mutations-headerset) + +## 菜单联动 + +首先请明确一点,D2Admin 完整版的菜单联动只是一个简单方案,不要拘泥于此演示,下面介绍完整版联动的实现帮助您更快速实现自己的联动方案: + +设置数据源 + +在 `d2-admin/src/menu/index.js` 中导出了两个变量,分别是: + +* menuAside 预备侧边栏菜单 +* menuHeader 顶栏菜单 + +在 main.js 中使用下面的方式导入 + +``` js +import { menuHeader, menuAside } from '@/menu' +``` + +menuHeader 在初始化根实例时在 created 生命周期直接赋值给顶栏菜单 + +``` js +this.$store.commit('d2admin/menu/headerSet', menuHeader) +``` + +然后在根实例中添加 $route.matched 的监听器 + +``` js +watch: { + '$route.matched' (val) { + const _side = menuAside.filter(menu => menu.path === val[0].path) + this.$store.commit('d2admin/menu/asideSet', _side.length > 0 ? _side[0].children : []) + } +} +``` + +这段代码的作用是当路由改变时,根据当前的路由找到 menuAside 中匹配当前路由对象中顶级路由的那个项目,并且赋值给侧边栏菜单达到联动效果。 + +您可以删除这部分代码,随意使用 vuex 中提供的顶栏和侧边栏菜单的设置方法来实现自己的菜单联动。 \ No newline at end of file diff --git a/docs/zh/sys-multi-page/README.md b/docs/zh/sys-multi-page/README.md new file mode 100644 index 00000000..9fabda3d --- /dev/null +++ b/docs/zh/sys-multi-page/README.md @@ -0,0 +1,30 @@ +--- +sidebar: auto +--- + +# 多页面 + +D2Admin 默认支持多页面,并且支持多页面控制器上的 tab 标签页右键菜单控制,可以实现“关闭全部”,“关闭其它”,“关闭左侧”,“关闭右侧”的功能。 + +## 注册页面 + +D2Admin 的多页面设置源头在 `d2-admin/src/router/routes.js`,该文件导出了一个 `frameInRoutes` 变量,`d2-admin/src/main.js` 中使用下面的方式导入: + +``` js +import { frameInRoutes } from '@/router/routes' +``` + +然后在根实例中加入了一个名为 `getAllPageFromRoutes` 的方法,该方法在 `created` 生命周期调用,递归处理 `frameInRoutes` 中的数据将支持多标签页显示所有页面数据扁平为一位数组,然后使用: + +``` js +$store.commit('d2admin/page/poolSet', pool) +``` +将得到的路由数据存储到 vuex 中备用。这份数据在操作多页面数据时会使用到。 + +## 触发 + +新建页面的触发在 `d2-admin/src/router/index.js` 中的 `router.afterEach` 钩子中。涉及的方法参见 [API](../sys-vuex/#page) + +## 标签页控制 + +标签页组件在 `d2-admin/src/layout/header-aside/components/tabs/index.vue`,该组件实现多页面的各种关闭控制。涉及的方法参见 [API](../sys-vuex/#page) \ No newline at end of file diff --git a/docs/zh/plugins/README.md b/docs/zh/sys-plugins/README.md similarity index 100% rename from docs/zh/plugins/README.md rename to docs/zh/sys-plugins/README.md diff --git a/docs/zh/sys-plugins/console.md b/docs/zh/sys-plugins/console.md new file mode 100644 index 00000000..1ff72524 --- /dev/null +++ b/docs/zh/sys-plugins/console.md @@ -0,0 +1,51 @@ +# 控制台打印优化 + +使用 $log 可以在控制台输出美观的日志信息 + + + +## 胶囊 + +此方法打印一行“胶囊”样式的信息,即上图前四条 + +**参数:** + +$log.capsule( `左侧文字`, `右侧文字`, `主题样式` ) + +**示例:** + +``` js +this.$log.capsule('title', 'success', 'success') +``` + +## 彩色文字 + +此方法可以随意组合打印文字的颜色顺序 + +``` js +this.$log.colorful([ + { text: 'H', type: 'default' }, + { text: 'e', type: 'primary' }, + { text: 'l', type: 'success' }, + { text: 'l', type: 'warning' }, + { text: 'o', type: 'danger' } +]) +``` + +上面的代码效果为效果图中第五行 + +## 快速方法 + +* $log.default +* $log.primary +* $log.success +* $log.warning +* $log.danger + +**示例:** + +``` js +this.$log.primary('primary style') +``` + +这五个快速方法的效果为效果图中第六至十行 \ No newline at end of file diff --git a/docs/zh/plugins/data-export.md b/docs/zh/sys-plugins/data-export.md similarity index 100% rename from docs/zh/plugins/data-export.md rename to docs/zh/sys-plugins/data-export.md diff --git a/docs/zh/plugins/data-import.md b/docs/zh/sys-plugins/data-import.md similarity index 100% rename from docs/zh/plugins/data-import.md rename to docs/zh/sys-plugins/data-import.md diff --git a/docs/zh/sys-plugins/error.md b/docs/zh/sys-plugins/error.md new file mode 100644 index 00000000..6ad8c571 --- /dev/null +++ b/docs/zh/sys-plugins/error.md @@ -0,0 +1,13 @@ +# 错误捕捉 + +框架内已经做好错误捕捉处理,您不需要任何设置,当发生一个错误时,错误会被自动记录在日志中,并且在控制台显示相关错误信息。 + +日志查看界面: + +![](http://fairyever.qiniudn.com/20180820173544.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) + +控制台输出: + +> 只在开发模式下输出 + +![](http://fairyever.qiniudn.com/20180820172927.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) \ No newline at end of file diff --git a/docs/zh/plugins/i18n.md b/docs/zh/sys-plugins/i18n.md similarity index 100% rename from docs/zh/plugins/i18n.md rename to docs/zh/sys-plugins/i18n.md diff --git a/docs/zh/sys-plugins/log.md b/docs/zh/sys-plugins/log.md new file mode 100644 index 00000000..8e8c66ad --- /dev/null +++ b/docs/zh/sys-plugins/log.md @@ -0,0 +1,17 @@ +# 日志 + +使用 $logAdd 可以快速记录日志 + +示例: + +![](http://fairyever.qiniudn.com/20180820174810.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) + +查看日志: + +![](http://fairyever.qiniudn.com/20180820174524.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim) + +使用方式: + +``` js +this.$logAdd('your log text') +``` \ No newline at end of file diff --git a/docs/zh/plugins/mock.md b/docs/zh/sys-plugins/mock.md similarity index 98% rename from docs/zh/plugins/mock.md rename to docs/zh/sys-plugins/mock.md index edb33169..48165b7d 100644 --- a/docs/zh/plugins/mock.md +++ b/docs/zh/sys-plugins/mock.md @@ -1,6 +1,6 @@ # 模拟数据 -在 `src/mock/demo/001.js` 配置拦截返回的数据 +使用模拟数据可以在接口还没做好的时候更方便地进行你的开发 ## 使用 diff --git a/docs/zh/sys-route/README.md b/docs/zh/sys-route/README.md new file mode 100644 index 00000000..2a9d412b --- /dev/null +++ b/docs/zh/sys-route/README.md @@ -0,0 +1,76 @@ +--- +sidebar: auto +--- + +# 路由 + +## 数据 + +完整版的 D2Admin 路由设置文件在 `d2-admin/src/router/routes.js`。 + +需要注意的是大多数路由设置要写在 frameIn 下。frameIn 中的页面会在嵌套在一个包含顶栏和侧边栏的页面布局中显示。 + +## 路由配置 + +路由注册和钩子设置文件为 `d2-admin/src/router/index.js`,此文件中将 `routes.js` 中导出的 routes 变量注册到路由,并且设置后续的路由拦截和登陆状态判断,多页面的新建页面事件触发也来自这里。该文件再导出注册了所有页面的路由实例,在 `main.js` 中注册到 vue 根实例。 + +## 路由缓存 + +路由缓存默认为开启状态,页面组件会被 keepAlive,如果想禁用某个页面的缓存,请在该路由配置的 meta 中加入: + +``` js +meta: { + notCache: true +} +``` + +最后结果类似这样: + +``` js {7} +{ + path: '/page-cache/off', + name: 'page-cache-off', + component: () => import('xxx.vue'), + meta: { + requiresAuth: true, + notCache: true, + title: '关闭缓存' + } +} +``` + +虽然所有的路由默认都是开启缓存的,但是还需要遵守一个约定才可以正确缓存页面: + +**页面组件必须有 name 字段,并且 name 字段的值和该路由的 name 字段一致。** + +例如: + +页面文件: + +``` vue {9} + + + +``` + +路由设置: + +``` js {3} +{ + path: '/page-cache/on', + name: 'page-cache-on', + component: () => import('xxx.vue'), + meta: { + requiresAuth: true, + title: '开启缓存' + } +} +``` \ No newline at end of file diff --git a/docs/zh/plugins/util.md b/docs/zh/sys-util/README.md similarity index 90% rename from docs/zh/plugins/util.md rename to docs/zh/sys-util/README.md index ea87b939..51d7eff5 100644 --- a/docs/zh/plugins/util.md +++ b/docs/zh/sys-util/README.md @@ -1,13 +1,11 @@ +--- +sidebar: auto +--- + # Util 实用工具 -::: tip -此文档已经不对应最新版本的代码,文档会在稍后完善 -::: - D2Admin 的 util 模块位置:`d2-admin/src/libs/util.js` -下面列举您在开发中很有可能会用到的 util 模块方法。这并不是模块的全部内容,如果您有兴趣可以亲自浏览模块代码。 - ## util.cookies.set **介绍:** @@ -148,6 +146,24 @@ util.title('NewTitle') `process.env.VUE_APP_TITLE` 在 `d2-admin/.env` 和 `d2-admin/.env.development` 中设置 ::: +## util.open + +**介绍:** + +打开新页面 + +**参数** + +| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 | +| --- | --- | --- | --- | --- | --- | +| url | 新的页面地址 | 必选 | String | | | + +**使用示例:** + +``` js +util.open('http://www.xxx.com') +``` + ## util.ua **介绍:** diff --git a/docs/zh/sys-vuex/README.md.REMOVED.git-id b/docs/zh/sys-vuex/README.md.REMOVED.git-id new file mode 100644 index 00000000..269c6858 --- /dev/null +++ b/docs/zh/sys-vuex/README.md.REMOVED.git-id @@ -0,0 +1 @@ +6d1ab0795b7a8af170734dfabddadca1da1329cf \ No newline at end of file diff --git a/src/layout/header-aside/components/header-error-log/index.vue b/src/layout/header-aside/components/header-error-log/index.vue index c326860a..563e3be6 100644 --- a/src/layout/header-aside/components/header-error-log/index.vue +++ b/src/layout/header-aside/components/header-error-log/index.vue @@ -34,7 +34,6 @@ 清空 - diff --git a/src/pages/demo/playground/db/page-snapshot-public/index.vue b/src/pages/demo/playground/db/page-snapshot-public/index.vue index 3b86d04c..89305695 100644 --- a/src/pages/demo/playground/db/page-snapshot-public/index.vue +++ b/src/pages/demo/playground/db/page-snapshot-public/index.vue @@ -86,7 +86,7 @@ export default { } }, async created () { - const data = await this.pageLoad({ vm: this }) + const data = await this.pageGet({ vm: this }) for (const key in data) { if (data.hasOwnProperty(key)) this[key] = data[key] } @@ -102,7 +102,7 @@ export default { methods: { ...mapActions('d2admin/db', [ 'pageSet', - 'pageLoad', + 'pageGet', 'pageClear' ]), async handleClear () { diff --git a/src/pages/demo/playground/db/page-snapshot-user/index.vue b/src/pages/demo/playground/db/page-snapshot-user/index.vue index 4e17b74a..15dbc60e 100644 --- a/src/pages/demo/playground/db/page-snapshot-user/index.vue +++ b/src/pages/demo/playground/db/page-snapshot-user/index.vue @@ -86,7 +86,7 @@ export default { } }, async created () { - const data = await this.pageLoad({ vm: this, user: true }) + const data = await this.pageGet({ vm: this, user: true }) for (const key in data) { if (data.hasOwnProperty(key)) this[key] = data[key] } @@ -102,7 +102,7 @@ export default { methods: { ...mapActions('d2admin/db', [ 'pageSet', - 'pageLoad', + 'pageGet', 'pageClear' ]), async handleClear () { diff --git a/src/store/modules/d2admin/modules/account.js b/src/store/modules/d2admin/modules/account.js index 927188b4..6aef0392 100644 --- a/src/store/modules/d2admin/modules/account.js +++ b/src/store/modules/d2admin/modules/account.js @@ -32,7 +32,7 @@ export default { commit('d2admin/user/set', { name: res.data.name }, { root: true }) - // 用户登陆后从数据库加载一系列的设置 + // 用户登陆后从持久化数据加载一系列的设置 commit('d2admin/account/load', null, { root: true }) // 跳转路由 vm.$router.push({ @@ -51,7 +51,7 @@ export default { * @param {Object} param vm {Object} vue 实例 * @param {Object} param confirm {Boolean} 是否需要确认 */ - logout ({ commit }, { vm, confirm }) { + logout ({ commit }, { vm, confirm = false }) { /** * @description 注销 */ @@ -87,8 +87,7 @@ export default { }, mutations: { /** - * @class ... - * @description 用户登陆后从数据库加载一系列的设置 + * @description 用户登陆后从持久化数据加载一系列的设置 * @param {Object} state vuex state */ load (state) { @@ -98,9 +97,9 @@ export default { this.commit('d2admin/theme/load') // DB -> store 加载页面过渡效果设置 this.commit('d2admin/transition/load') - // DB -> store 数据库加载上次退出时的多页列表 + // DB -> store 持久化数据加载上次退出时的多页列表 this.commit('d2admin/page/openedLoad') - // DB -> store 数据库加载这个用户之前设置的侧边栏折叠状态 + // DB -> store 持久化数据加载这个用户之前设置的侧边栏折叠状态 this.commit('d2admin/menu/asideCollapseLoad') } } diff --git a/src/store/modules/d2admin/modules/db.js b/src/store/modules/d2admin/modules/db.js index 8160ac25..b8045c71 100644 --- a/src/store/modules/d2admin/modules/db.js +++ b/src/store/modules/d2admin/modules/db.js @@ -11,7 +11,7 @@ import util from '@/libs/util.js' * @returns {String} 可以直接使用的路径 */ function pathInit ({ - dbName = 'db', + dbName = 'database', path = '', user = true, validator = () => true, @@ -30,46 +30,50 @@ function pathInit ({ export default { namespaced: true, - mutations: { + actions: { /** * @description 将数据存储到指定位置 | 路径不存在会自动初始化 - * @description 效果类似于 dbName.path = value - * @param {Object} state vuex state + * @description 效果类似于取值 dbName.path = value * @param {Object} param dbName {String} 数据库名称 * @param {Object} param path {String} 存储路径 * @param {Object} param value {*} 需要存储的值 + * @param {Object} param user {Boolean} 是否区分用户 */ - set (state, { - dbName = 'db', + set (context, { + dbName = 'database', path = '', - value = '' + value = '', + user = false }) { db.set(pathInit({ dbName, path, - user: false + user }), value).write() }, /** - * @description 将数据存储到指定位置 | 路径不存在会自动初始化 [ 区分用户 ] - * @description 效果类似于 dbName.path[user] = value - * @param {Object} state vuex state + * @description 获取数据 + * @description 效果类似于取值 dbName.path || defaultValue * @param {Object} param dbName {String} 数据库名称 * @param {Object} param path {String} 存储路径 - * @param {Object} param value {*} 需要存储的值 + * @param {Object} param defaultValue {*} 取值失败的默认值 + * @param {Object} param user {Boolean} 是否区分用户 */ - setByUser (state, { - dbName = 'db', + get (context, { + dbName = 'database', path = '', - value = '' + defaultValue = '', + user = false }) { - db.set(pathInit({ - dbName, - path - }), value).write() - } - }, - actions: { + return new Promise(resolve => { + resolve(db.get(pathInit({ + dbName, + path, + user, + defaultValue + })).value()) + }) + }, /** * @description 获取存储数据库对象 * @param {Object} context context @@ -177,7 +181,7 @@ export default { * @param {Object} param basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} param user {Boolean} 是否区分用户 */ - pageLoad (context, { + pageGet (context, { vm, basis = 'name', user = false @@ -212,50 +216,6 @@ export default { defaultValue: {} }))) }) - }, - /** - * @description 获取数据 - * @description 效果类似于 dbName.path || defaultValue - * @param {Object} state vuex state - * @param {Object} param dbName {String} 数据库名称 - * @param {Object} param path {String} 存储路径 - * @param {Object} param defaultValue {*} 取值失败的默认值 - */ - get (context, { - dbName = 'db', - path = '', - defaultValue = '' - }) { - return new Promise(resolve => { - resolve(db.get(pathInit({ - dbName, - path, - user: false, - defaultValue - })).value()) - }) - }, - /** - * @description 获取数据 [ 区分用户 ] - * @description 效果类似于 dbName.path[user] || defaultValue - * @param {Object} state vuex state - * @param {Object} param dbName {String} 数据库名称 - * @param {Object} param path {String} 存储路径 - * @param {Object} param defaultValue {*} 取值失败的默认值 - */ - getByUser (context, { - dbName = 'db', - path = '', - defaultValue = '' - }) { - return new Promise((resolve, reject) => { - resolve(db.get(pathInit({ - dbName, - path, - user: true, - defaultValue - })).value()) - }) } } } diff --git a/src/store/modules/d2admin/modules/gray.js b/src/store/modules/d2admin/modules/gray.js index 137ddd00..b46c88c5 100644 --- a/src/store/modules/d2admin/modules/gray.js +++ b/src/store/modules/d2admin/modules/gray.js @@ -15,10 +15,10 @@ export default { /** * @description 设置灰度模式 * @param {Object} state vuex state - * @param {Boolean} value new value + * @param {Boolean} active active */ - set (state, value) { - state.active = value + set (state, active) { + state.active = active } } } diff --git a/src/store/modules/d2admin/modules/log.js b/src/store/modules/d2admin/modules/log.js index ceb40377..e6517cc3 100644 --- a/src/store/modules/d2admin/modules/log.js +++ b/src/store/modules/d2admin/modules/log.js @@ -37,7 +37,6 @@ export default { actions: { /** * @description 添加一个日志 - * @param {Object} state vuex state * @param {Object} param type {String} 类型 * @param {Object} param err {Error} 错误对象 * @param {Object} param vm {Object} vue 实例 diff --git a/src/store/modules/d2admin/modules/menu.js b/src/store/modules/d2admin/modules/menu.js index 48327f94..99db6e8e 100644 --- a/src/store/modules/d2admin/modules/menu.js +++ b/src/store/modules/d2admin/modules/menu.js @@ -13,6 +13,7 @@ export default { }, mutations: { /** + * @description 设置顶栏菜单 * @param {Object} state vuex state * @param {Array} menu menu setting */ @@ -21,6 +22,7 @@ export default { state.header = menu }, /** + * @description 设置侧边栏菜单 * @param {Object} state vuex state * @param {Array} menu menu setting */ @@ -37,10 +39,11 @@ export default { // store 赋值 state.asideCollapse = collapse // 持久化 - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'menu.asideCollapse', - value: state.asideCollapse + value: state.asideCollapse, + user: true }) }, /** @@ -51,22 +54,24 @@ export default { // store 赋值 state.asideCollapse = !state.asideCollapse // 持久化 - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'menu.asideCollapse', - value: state.asideCollapse + value: state.asideCollapse, + user: true }) }, /** - * 从数据库读取侧边栏展开或者收缩 + * 从持久化数据读取侧边栏展开或者收缩 * @param {Object} state vuex state */ async asideCollapseLoad (state) { // store 赋值 - state.asideCollapse = await this.dispatch('d2admin/db/getByUser', { + state.asideCollapse = await this.dispatch('d2admin/db/get', { dbName: 'sys', path: 'menu.asideCollapse', - defaultValue: setting.menu.asideCollapse + defaultValue: setting.menu.asideCollapse, + user: true }) } } diff --git a/src/store/modules/d2admin/modules/page.js b/src/store/modules/d2admin/modules/page.js index e0d50ccf..7ac2c47b 100644 --- a/src/store/modules/d2admin/modules/page.js +++ b/src/store/modules/d2admin/modules/page.js @@ -93,23 +93,25 @@ export default { * @param {Object} state vuex state */ opend2db (state) { - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'page.opened', - value: state.opened + value: state.opened, + user: true }) }, /** * @class opened - * @description 从数据库载入分页列表 + * @description 从持久化数据载入分页列表 * @param {Object} state vuex state */ async openedLoad (state) { // store 赋值 - const value = await this.dispatch('d2admin/db/getByUser', { + const value = await this.dispatch('d2admin/db/get', { dbName: 'sys', path: 'page.opened', - defaultValue: setting.page.opened + defaultValue: setting.page.opened, + user: true }) // 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签 // 以 name 字段为准 diff --git a/src/store/modules/d2admin/modules/theme.js b/src/store/modules/d2admin/modules/theme.js index d6b4677b..e12b1439 100644 --- a/src/store/modules/d2admin/modules/theme.js +++ b/src/store/modules/d2admin/modules/theme.js @@ -20,7 +20,7 @@ export default { }, mutations: { /** - * @description 激活一个主题(应用到dom上) + * @description 激活一个主题 * @param {Object} state vuex state * @param {String} themeValue 需要激活的主题名称 */ @@ -30,22 +30,24 @@ export default { // 将 vuex 中的主题应用到 dom this.commit('d2admin/theme/dom') // 持久化 - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'theme.activeName', - value: state.activeName + value: state.activeName, + user: true }) }, /** - * @description 从数据库加载主题设置 + * @description 从持久化数据加载主题设置 * @param {Object} state vuex state */ async load (state) { // store 赋值 - state.activeName = await this.dispatch('d2admin/db/getByUser', { + state.activeName = await this.dispatch('d2admin/db/get', { dbName: 'sys', path: 'theme.activeName', - defaultValue: state.list[0].name + defaultValue: state.list[0].name, + user: true }) // 更新到页面 this.commit('d2admin/theme/dom') diff --git a/src/store/modules/d2admin/modules/transition.js b/src/store/modules/d2admin/modules/transition.js index 566da7ac..2f46a355 100644 --- a/src/store/modules/d2admin/modules/transition.js +++ b/src/store/modules/d2admin/modules/transition.js @@ -17,10 +17,11 @@ export default { // store 赋值 state.active = active // 持久化 - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'transition.active', - value: state.active + value: state.active, + user: true }) }, /** @@ -29,10 +30,11 @@ export default { */ async load (state) { // store 赋值 - state.active = await this.dispatch('d2admin/db/getByUser', { + state.active = await this.dispatch('d2admin/db/get', { dbName: 'sys', path: 'transition.active', - defaultValue: setting.transition.active + defaultValue: setting.transition.active, + user: true }) } } diff --git a/src/store/modules/d2admin/modules/user.js b/src/store/modules/d2admin/modules/user.js index 5b2728bd..add8a466 100644 --- a/src/store/modules/d2admin/modules/user.js +++ b/src/store/modules/d2admin/modules/user.js @@ -17,10 +17,11 @@ export default { // store 赋值 state.info = info // 持久化 - this.commit('d2admin/db/setByUser', { + this.dispatch('d2admin/db/set', { dbName: 'sys', path: 'user.info', - value: info + value: info, + user: true }) }, /** @@ -29,10 +30,11 @@ export default { */ async load (state) { // store 赋值 - state.info = await this.dispatch('d2admin/db/getByUser', { + state.info = await this.dispatch('d2admin/db/get', { dbName: 'sys', path: 'user.info', - defaultValue: setting.user.info + defaultValue: setting.user.info, + user: true }) } }