From 53803d067dc962e6e15c0471253aaab532c35614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Ng=E1=BB=8Dc=20H=C3=B2a?= Date: Wed, 27 Nov 2019 09:06:28 +0700 Subject: [PATCH 1/3] perf: format pdf download (#2791) --- src/views/pdf/download.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/views/pdf/download.vue b/src/views/pdf/download.vue index bd0b3be2735..a348c6978b0 100644 --- a/src/views/pdf/download.vue +++ b/src/views/pdf/download.vue @@ -26,17 +26,17 @@ export default { }, methods: { fetchData() { - import('./content.js').then(data => { - const { title } = data.default - document.title = title - this.article = data.default - setTimeout(() => { - this.fullscreenLoading = false - this.$nextTick(() => { - window.print() - }) - }, 3000) - }) + import('./content.js').then(data => { + const { title } = data.default + document.title = title + this.article = data.default + setTimeout(() => { + this.fullscreenLoading = false + this.$nextTick(() => { + window.print() + }) + }, 3000) + }) } } } From e1554fdbd0d03413a46dd64797abc299446b328e Mon Sep 17 00:00:00 2001 From: xuanzai <43233731+MikuBlog@users.noreply.github.com> Date: Sun, 1 Dec 2019 15:48:30 +0800 Subject: [PATCH 2/3] perf[views/icons]: use grid (#2803) --- src/views/icons/index.vue | 54 +++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/views/icons/index.vue b/src/views/icons/index.vue index 3677afd6eb9..33fab3a3432 100644 --- a/src/views/icons/index.vue +++ b/src/views/icons/index.vue @@ -6,30 +6,34 @@ -
- -
- {{ generateIconCode(item) }} -
-
- - {{ item }} -
-
-
+
+
+ +
+ {{ generateIconCode(item) }} +
+
+ + {{ item }} +
+
+
+
-
- -
- {{ generateElementIconCode(item) }} -
-
- - {{ item }} -
-
-
+
+
+ +
+ {{ generateElementIconCode(item) }} +
+
+ + {{ item }} +
+
+
+
@@ -66,6 +70,12 @@ export default { .icons-container { margin: 10px 20px 0; overflow: hidden; + + .grid { + position: relative; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); + } .icon-item { margin: 20px; From 65d8c451e89c4f679cd983316b7b9a5f1e9ac748 Mon Sep 17 00:00:00 2001 From: monkeycf <41945134+monkeycf@users.noreply.github.com> Date: Wed, 4 Dec 2019 10:34:23 +0800 Subject: [PATCH 3/3] feat: plop new generate store (#2805) --- plop-templates/store/index.hbs | 16 +++++++++ plop-templates/store/prompt.js | 62 ++++++++++++++++++++++++++++++++++ plopfile.js | 2 ++ 3 files changed, 80 insertions(+) create mode 100644 plop-templates/store/index.hbs create mode 100644 plop-templates/store/prompt.js diff --git a/plop-templates/store/index.hbs b/plop-templates/store/index.hbs new file mode 100644 index 00000000000..4f8e2dc0b44 --- /dev/null +++ b/plop-templates/store/index.hbs @@ -0,0 +1,16 @@ +{{#if state}} +const state = {} +{{/if}} + +{{#if mutations}} +const mutations = {} +{{/if}} + +{{#if actions}} +const actions = {} +{{/if}} + +export default { + namespaced: true, + {{options}} +} diff --git a/plop-templates/store/prompt.js b/plop-templates/store/prompt.js new file mode 100644 index 00000000000..bcbc11d1f5b --- /dev/null +++ b/plop-templates/store/prompt.js @@ -0,0 +1,62 @@ +const { notEmpty } = require('../utils.js') + +module.exports = { + description: 'generate store', + prompts: [{ + type: 'input', + name: 'name', + message: 'store name please', + validate: notEmpty('name') + }, + { + type: 'checkbox', + name: 'blocks', + message: 'Blocks:', + choices: [{ + name: 'state', + value: 'state', + checked: true + }, + { + name: 'mutations', + value: 'mutations', + checked: true + }, + { + name: 'actions', + value: 'actions', + checked: true + } + ], + validate(value) { + if (!value.includes('state') || !value.includes('mutations')) { + return 'store require at least state and mutations' + } + return true + } + } + ], + actions(data) { + const name = '{{name}}' + const { blocks } = data + const options = ['state', 'mutations'] + const joinFlag = `, + ` + if (blocks.length === 3) { + options.push('actions') + } + + const actions = [{ + type: 'add', + path: `src/store/modules/${name}.js`, + templateFile: 'plop-templates/store/index.hbs', + data: { + options: options.join(joinFlag), + state: blocks.includes('state'), + mutations: blocks.includes('mutations'), + actions: blocks.includes('actions') + } + }] + return actions + } +} diff --git a/plopfile.js b/plopfile.js index 9f3147e2501..57387bf17ab 100644 --- a/plopfile.js +++ b/plopfile.js @@ -1,7 +1,9 @@ const viewGenerator = require('./plop-templates/view/prompt') const componentGenerator = require('./plop-templates/component/prompt') +const storeGenerator = require('./plop-templates/store/prompt.js') module.exports = function(plop) { plop.setGenerator('view', viewGenerator) plop.setGenerator('component', componentGenerator) + plop.setGenerator('store', storeGenerator) }