From 77926108101c4c57ddf51138b7f03c893b972755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=9B=E7=91=9E?= Date: Mon, 20 Apr 2020 17:57:33 +0800 Subject: [PATCH] Chore: release 1.2.10 --- .vscode/settings.json | 2 - .vscode/vue.code-snippets | 42 +- CHANGELOG.md | 6 + README.md | 5 +- package.json | 16 +- src/components/ChooserAsync.tsx | 47 +- src/components/ChooserAsyncFunctional.tsx | 98 ++- src/components/File.tsx | 153 ++-- src/components/Image.tsx | 137 ++-- src/components/RouterViewTransparent.ts | 32 +- src/pages/index/App.vue | 2 +- src/pages/index/router.ts | 35 +- src/pages/index/store/modules/prefer.ts | 17 +- src/pages/other/App.vue | 2 +- src/pages/other/components/File.tsx | 35 + src/pages/other/components/Image.tsx | 37 + src/pages/other/router.ts | 23 +- src/pages/other/store/index.ts | 6 +- .../other/store/modules/downloadManager.ts | 346 --------- src/pages/other/store/modules/dynamic.ts | 13 +- src/pages/other/store/modules/file.ts | 21 + src/pages/other/store/modules/image.ts | 21 + src/pages/other/store/modules/prefer.ts | 38 +- src/store/file.ts | 692 ++++++++++++++++++ src/store/image.ts | 309 ++++++++ src/store/prefer.ts | 25 +- src/store/user.ts | 14 +- src/utils/ajax.ts | 22 +- src/utils/clone.ts | 134 ++-- src/utils/downloader.ts | 20 +- src/utils/highOrder.ts | 40 +- src/utils/index.ts | 155 +++- src/utils/performance.ts | 129 +++- src/utils/sort/index.ts | 14 +- src/utils/sort/insert.ts | 2 +- src/utils/sort/merge.ts | 2 +- src/utils/sort/quick.ts | 2 +- src/utils/sort/quickStable.ts | 2 +- tests/unit/utils/clone.spec.ts | 5 +- yarn.lock | 554 +++++++------- 40 files changed, 2162 insertions(+), 1093 deletions(-) create mode 100644 src/pages/other/components/File.tsx create mode 100644 src/pages/other/components/Image.tsx delete mode 100644 src/pages/other/store/modules/downloadManager.ts create mode 100644 src/pages/other/store/modules/file.ts create mode 100644 src/pages/other/store/modules/image.ts create mode 100644 src/store/file.ts create mode 100644 src/store/image.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index aadbc0e..7089ff0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,8 +12,6 @@ "git.autofetch": true, "git.enableSmartCommit": true, - "svn.enableProposedApi": "product", - "files.trimTrailingWhitespace": true, "typescript.tsdk": "./node_modules/typescript/lib", diff --git a/.vscode/vue.code-snippets b/.vscode/vue.code-snippets index 85e2d91..0df724e 100644 --- a/.vscode/vue.code-snippets +++ b/.vscode/vue.code-snippets @@ -225,41 +225,28 @@ "} from 'vuex-module-decorators'", "import store from '${3:../}'", "", - "/** ${1:动态模块}", - " */", + "/** ${1:动态模块} */", "interface ${4:IDynamic} {", - " /** 是否动态", - " */", + " /** 是否动态 */", " dynamic: boolean", "", " // ...", "}", "", - "/** ${1:动态模块}", - " */", + "/** ${1:动态模块} */", "@Module({ dynamic: true, namespaced: true, name: '${5:dynamic}', store })", "class ${6:Dynamic} extends VuexModule implements ${4:IDynamic} {", " /// State & Getter(public) ///", " dynamic = true", "", - " /// Mutation 无法调用/commit 必须通过Action ///", + " /// Mutation ///", " @Mutation", - " private DYNAMIC(dynamic: boolean) {", + " DYNAMIC(dynamic: boolean) {", " this.dynamic = dynamic", " }", "", " /// Action ///", - " /** 设置动态【同步】", - " * @param {Boolean} dynamic 是否动态", - " */", - " @Action", - " setDynamic(dynamic: boolean) {", - " // this.context.commit('DYNAMIC', dynamic) // 非动态模块", - " this.DYNAMIC(dynamic) // 动态模块", - " }", - "", - " /** 初始化是否动态属性【异步】", - " */", + " /** 初始化是否动态属性 */", " @Action", " async initDynamic() {", " const dynamic = await Promise.resolve(true)", @@ -291,31 +278,20 @@ "} from 'vuex-module-decorators'", "import store from '${3:../}'", "", - "/** ${1:动态模块}", - " */", + "/** ${1:动态模块} */", "@Module({ dynamic: true, namespaced: true, name: '${4:dynamic}', store })", "class ${5:Dynamic} extends VuexModule {", " /// State & Getter(public) ///", " dynamic = true", "", - " /// Mutation 无法调用/commit 必须通过Action ///", + " /// Mutation ///", " @Mutation", " DYNAMIC(dynamic) {", " this.dynamic = dynamic", " }", "", " /// Action ///", - " /** 设置动态【同步】", - " * @param {Boolean} dynamic 是否动态", - " */", - " @Action", - " setDynamic(dynamic) {", - " // this.context.commit('DYNAMIC', dynamic) // 非动态模块", - " this.DYNAMIC(dynamic) // 动态模块", - " }", - "", - " /** 初始化是否动态属性【异步】", - " */", + " /** 初始化是否动态属性 */", " @Action", " async initDynamic() {", " const dynamic = await Promise.resolve(true)", diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4c0e9..5bba19a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +## v 1.2.10 + +- banner插件 +- 工具函数优化 +- 文件/图片下载内存管理 + ## v 1.2.9 - 修复异步css chunk包含不定数量(皮肤/默认)文件问题等 diff --git a/README.md b/README.md index 853587c..6993c94 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,7 @@ yarn vue-cli-service help # [命令] : 比如 yarn vue-cli-service help test:e2e - Vue实例**私有属性**命名规则(避免 [属性名](https://cn.vuejs.org/v2/style-guide/#私有属性名-必要) 冲突): - `$_` 实例命名空间(在保证易维护的前提下可以使用单字母, 但应尽量避免) - `_$` **全局/跨组件/hack**命名空间, 命名前应**先全局搜索**是否有重复 + - `/^[$_]+_$/` 注入**vue data 选项**命名空间应满足该正则, 即以`_`结尾(因为以`$_`其中一个字符开头的Vue不会劫持), 命名前应**先全局搜索**是否有重复 - 除了以下样式可以使用全局: @@ -604,8 +605,8 @@ yarn vue-cli-service help # [命令] : 比如 yarn vue-cli-service help test:e2e // ... ``` -- 路由视图不需要被缓存的, 可以在自己的`deactivated`钩子销毁实例`this.$destroy()` -- 所有响应路由变化的可缓存组件(不缓存如上), 应确保失活/休眠后不再响应路由变化, 推荐使用 `@com/ChooserAsyncFunctional` 包裹 +- 所有视图组件可接收props:`route`代替`this.$route`, 区别是: **只在首次进入当前视图或当前视图url发生变化时改变** +- 路由视图不需要被缓存的, 可以在`deactivated`钩子销毁实例(`this.$destroy()`)或者`activated`钩子进行更新 - 为避免渲染错误, 请务必为循环创建的组件**加上 `key`**, 特别是 `tsx/ts/jsx/js` 中 ### 配置和优化 diff --git a/package.json b/package.json index f96c392..3b0a07a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "crypto-js": "3.3.0", "d3": "^5.15.1", "echarts": "^4.7.0", - "element-ui": "^2.13.0", + "element-ui": "^2.13.1", "jsencrypt": "^3.0.0-rc.1", "luma.gl": "^7.3.2", "normalize.css": "^8.0.1", @@ -28,10 +28,10 @@ "three": "^0.115.0", "vue": "^2.6.11", "vue-class-component": "^7.2.3", - "vue-i18n": "^8.16.0", + "vue-i18n": "^8.17.3", "vue-property-decorator": "^8.4.1", "vue-router": "^3.1.6", - "vuex": "^3.1.3", + "vuex": "^3.2.0", "vuex-class": "^0.3.2", "vuex-module-decorators": "^0.16.1", "zdog": "^1.1.2", @@ -44,10 +44,10 @@ "@babel/plugin-proposal-private-methods": "^7.8.3", "@types/crypto-js": "3.1.44", "@types/d3": "^5.7.2", - "@types/echarts": "^4.4.5", + "@types/echarts": "^4.4.6", "@types/jest": "^25.2.1", - "@typescript-eslint/eslint-plugin": "^2.27.0", - "@typescript-eslint/parser": "^2.27.0", + "@typescript-eslint/eslint-plugin": "^2.28.0", + "@typescript-eslint/parser": "^2.28.0", "@vue/cli-plugin-babel": "~4.3.1", "@vue/cli-plugin-e2e-cypress": "~4.3.1", "@vue/cli-plugin-eslint": "~4.3.1", @@ -70,14 +70,14 @@ "eslint-plugin-vue": "^6.2.2", "fibers": "^4.0.2", "hard-source-webpack-plugin": "^0.13.1", - "lint-staged": "^10.1.3", + "lint-staged": "^10.1.6", "postcss-preset-env": "^6.7.0", "regenerate": "^1.4.0", "regjsgen": "^0.5.1", "regjsparser": "^0.6.4", "sass": "^1.26.3", "sass-loader": "^8.0.2", - "stylelint": "^13.3.1", + "stylelint": "^13.3.2", "stylelint-config-scss-maorey": "^1.1.1", "stylelint-webpack-plugin": "^1.2.3", "typescript": "~3.8.3", diff --git a/src/components/ChooserAsync.tsx b/src/components/ChooserAsync.tsx index 30b52ae..d6d4bb8 100644 --- a/src/components/ChooserAsync.tsx +++ b/src/components/ChooserAsync.tsx @@ -24,24 +24,36 @@ export const enum status { loading = 2, error = 3, empty = 4, + success = 5, } type component = status | string | Comp type filter = (data: any) => { data: any; comp: component } | void -/// 选项 name,directives,filters,extends,mixins /// +const DIC_SLOT = { + [status.none]: 'none', + [status.loading]: 'loading', + [status.error]: 'error', + [status.empty]: 'empty', +} /** 异步选择器组件, 最终渲染组件将得到一个prop: data, 即异步结果 * - * props: 见: @Prop 【注意】: get/error 变化时会重新请求 + * props: 见: Prop 【注意】: get/error 变化时会重新请求 + * * events: 见: const enum status 键值 - * slots: 支持默认插槽/默认作用域插槽 二选一 (二者都有时无法确定顺序, 所以只能二选一) + * + * slots: 见: const enum status 键值, 支持对应作用域插槽/插槽【二选一】作用域插槽优先(二者都有时无法确定顺序, 故) + * * 示例: *