first commit
This commit is contained in:
31
view/catch-admin/docs/add-page-loading-animate.md
Normal file
31
view/catch-admin/docs/add-page-loading-animate.md
Normal file
@@ -0,0 +1,31 @@
|
||||
为首屏增加 加载动画
|
||||
====
|
||||
|
||||
|
||||
|
||||
## 需求
|
||||
|
||||
> 为了缓解用户第一次访问时,加载 JS 过大所导致用户等待白屏时间过长导致的用户体验不好,进行的一个优化动效。
|
||||
|
||||
|
||||
|
||||
## 实现方案
|
||||
|
||||
1. 将 动画加载 dom 元素放在 #app 内,Vue 生命周期开始时,会自动清掉 #app 下的所有元素。
|
||||
2. 将 动画加载 dom 元素放在 body 下,Vue 生命周期开始时 App.vue (created, mounted) 调用 `@/utils/utll` 下的 removeLoadingAnimate(#id, timeout) 则会移除加载动画
|
||||
|
||||
最后一步:
|
||||
将样式插入到 `public/index.html` 文件的 `<head></head>` 最好写成内联 `<style>动画样式</style>`
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
目前提供有两个样式,均在 `public/loading` 文件夹内。且 pro 已经默认使用了一套 loading 动画方案,可以直接参考 `public/index.html`
|
||||
|
||||
|
||||
## 写在最后
|
||||
|
||||
目前 pro 有页面 overflow 显示出浏览器滚动条时,页面会抖动一下的问题。
|
||||
|
||||
欢迎各位提供能解决的方案和实现 demo。如果在条件允许的情况下,建议请直接使用 pro 进行改造,也欢迎直接 PR 到 pro 的仓库
|
95
view/catch-admin/docs/load-on-demand.md
Normal file
95
view/catch-admin/docs/load-on-demand.md
Normal file
@@ -0,0 +1,95 @@
|
||||
按需加载 减小打包
|
||||
====
|
||||
|
||||
|
||||
|
||||
## 按需引入组件依赖
|
||||
|
||||
`Ant Design Pro Vue` 默认编码工作并不支持按需引入,不过可以通过以下操作结合 [Ant Design Of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 官方文档来进行按需引入。
|
||||
|
||||
- 增加项目按需引入依赖
|
||||
- 修改引入组件方式
|
||||
|
||||
|
||||
|
||||
1. 增加按需引入所需依赖 `babel-plugin-import`
|
||||
并且修改文件 `babel.config.js`
|
||||
```ecmascript 6
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/app'
|
||||
],
|
||||
plugins: [
|
||||
[ "import", {
|
||||
"libraryName": "ant-design-vue",
|
||||
"libraryDirectory": "es",
|
||||
"style": "css"
|
||||
} ]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
2. 修改引入组件方式 (注意,这只是一个例子,请完整引入你所需要的组件)
|
||||
|
||||
文件 `@/core/lazy_lib/component_use.js`
|
||||
|
||||
```javascript
|
||||
import Vue from 'vue'
|
||||
import {
|
||||
Input,
|
||||
Button,
|
||||
Select,
|
||||
Card,
|
||||
Form,
|
||||
Row,
|
||||
Col,
|
||||
Modal,
|
||||
Table,
|
||||
notification
|
||||
} from 'ant-design-vue'
|
||||
|
||||
Vue.use(Input)
|
||||
Vue.use(Button)
|
||||
Vue.use(Select)
|
||||
Vue.use(Card)
|
||||
Vue.use(Form)
|
||||
Vue.use(Row)
|
||||
Vue.use(Col)
|
||||
Vue.use(Modal)
|
||||
Vue.use(Table)
|
||||
Vue.use(notification)
|
||||
|
||||
Vue.prototype.$notification = notification;
|
||||
```
|
||||
|
||||
|
||||
3. 最后在 `main.js` 中引入 `@/core/lazy_use.js` 文件即可,如下
|
||||
|
||||
```javascript
|
||||
|
||||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
|
||||
// 引入 按需组件的统一引入文件
|
||||
import './core/lazy_use'
|
||||
|
||||
import './style/index.less'
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
}).$mount('#app')
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 其他 减少打包大小
|
||||
|
||||
|
||||
|
||||
1. Ant Design Vue 1.2.x 版本起,采用的 ant-design 官方方案 svg Icon 组件,整个项目打包会变大很多,图标进行按需加载可参考 https://github.com/HeskeyBaozi/reduce-antd-icons-bundle-demo
|
||||
2. moment 按需加载 可参考 https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
28
view/catch-admin/docs/multi-tabs.md
Normal file
28
view/catch-admin/docs/multi-tabs.md
Normal file
@@ -0,0 +1,28 @@
|
||||
多(页签)标签 模式
|
||||
====
|
||||
|
||||
|
||||
## 让框架支持打开的页面增加多标签,可随时切换
|
||||
|
||||
### 关于如何移除该功能 组件
|
||||
1. 移除 `/src/layouts/BasicLayout.vue` L44, L69, L80
|
||||
```vue
|
||||
// L44
|
||||
<multi-tab v-if="multiTab"></multi-tab>
|
||||
|
||||
// L69
|
||||
import MultiTab from '@/components/MultiTab'
|
||||
|
||||
// L80
|
||||
MultiTab,
|
||||
```
|
||||
2. 移除 `/src/config/defaultSettings.js` L25
|
||||
|
||||
3. 移除 `src/store/modules/app.js` L27, L76-L79, L118-L120
|
||||
|
||||
4. 移除 `src/utils/mixin.js` L21
|
||||
|
||||
5. 删除组件目录 `src/components/MultiTab`
|
||||
|
||||
> 以上 `L x` 均代表行N ,如 L3 = 行3
|
||||
|
40
view/catch-admin/docs/webpack-bundle-analyzer.md
Normal file
40
view/catch-admin/docs/webpack-bundle-analyzer.md
Normal file
@@ -0,0 +1,40 @@
|
||||
先增加依赖
|
||||
|
||||
```bash
|
||||
// npm
|
||||
$ npm install --save-dev webpack-bundle-analyzer
|
||||
|
||||
// or yarn
|
||||
$ yarn add webpack-bundle-analyzer -D
|
||||
```
|
||||
|
||||
配置文件 `vue.config.js` 增加 `configureWebpack.plugins` 参数
|
||||
|
||||
```
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
// vue.config.js
|
||||
module.exports = {
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
// Ignore all locale files of moment.js
|
||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||
// 依赖大小分析工具
|
||||
new BundleAnalyzerPlugin(),
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
启动 `cli` 的 `build` 命令进行项目编译,编译完成时,会自动运行一个 http://localhost:8888 的地址,完整显示了支持库依赖
|
Reference in New Issue
Block a user