From 7439e98c17c2e7397aa5ecfdde806d750fad45e2 Mon Sep 17 00:00:00 2001
From: markthree <1801982702@qq.com>
Date: Wed, 10 Jan 2024 13:05:33 +0800
Subject: [PATCH 1/2] feat: add extractStyle
---
README.md | 24 +++-
playground/app.vue | 144 ++++++++++++-----------
src/config.ts | 3 +-
src/module.ts | 26 +++-
src/runtime/components/AExtractStyle.vue | 21 ++++
src/types.ts | 1 +
6 files changed, 143 insertions(+), 76 deletions(-)
create mode 100644 src/runtime/components/AExtractStyle.vue
diff --git a/README.md b/README.md
index 8c4f5ab..c7763c7 100644
--- a/README.md
+++ b/README.md
@@ -69,9 +69,11 @@ const handleMessage = () => {
}
-
- button
-
+
+
+ button
+
+
```
Reference [Nuxt documentation](https://nuxt.com/docs/guide/directory-structure/components) and [playground](./playground/app.vue) use.
@@ -99,6 +101,22 @@ If you wish to add automatically import content from Ant Design Vue, you can add
If there are components that are not imported automatically from @ant-design/icons-vue, you need to add the component name here.
+### extractStyle
+
+* Type: `boolean`
+
+Extract css on demand, start by default
+
+```vue
+
+
+
+
+
+
+```
+
+
## Development
```bash
diff --git a/playground/app.vue b/playground/app.vue
index cff7394..4cf6286 100644
--- a/playground/app.vue
+++ b/playground/app.vue
@@ -1,81 +1,83 @@
-
-
-
+
+
+
+
+
+
+ dark
+
+
+ light
+
+
+
+
+
+
-
- dark
+
+ message success
-
- light
+
+ message info
-
-
-
-
-
-
- message success
-
-
- message info
-
-
-
-
- modal success
-
-
- modal info
-
-
-
-
+
+ modal success
+
+
+ modal info
+
+
+
+
+ notification success
+
+
+ notification info
+
+
+
- notification success
-
-
- notification info
-
-
-
-
-
- horizontal
-
-
- vertical
-
-
-
-
+
+
+ horizontal
+
+
+ vertical
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/types.ts b/src/types.ts
index a6eea6c..a6f3d54 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -5,6 +5,7 @@ export interface Options {
icons: false | PresetImport[]
components: false | PresetImport[]
imports: PresetImport[]
+ extractStyle: boolean
}
From 48db824c47d77b27f0173a42e9f010f145697d2c Mon Sep 17 00:00:00 2001
From: markthree <1801982702@qq.com>
Date: Wed, 10 Jan 2024 14:09:52 +0800
Subject: [PATCH 2/2] fix!(extractStyle): close by default
---
README.md | 14 +++++++-------
playground/nuxt.config.ts | 4 +++-
src/config.ts | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index c7763c7..6a37e88 100644
--- a/README.md
+++ b/README.md
@@ -69,11 +69,9 @@ const handleMessage = () => {
}
-
-
- button
-
-
+
+ button
+
```
Reference [Nuxt documentation](https://nuxt.com/docs/guide/directory-structure/components) and [playground](./playground/app.vue) use.
@@ -105,10 +103,12 @@ If there are components that are not imported automatically from @ant-design/ico
* Type: `boolean`
-Extract css on demand, start by default
+> Solve page css flicker problem
+
+Extracts and injects css on demand, defaults to false
```vue
-
+
diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts
index 35f738f..f933af1 100644
--- a/playground/nuxt.config.ts
+++ b/playground/nuxt.config.ts
@@ -1,6 +1,8 @@
export default defineNuxtConfig({
modules: ['../src/module'],
- antd: {},
+ antd: {
+ extractStyle: true
+ },
imports:{
autoImport:true
},
diff --git a/src/config.ts b/src/config.ts
index cea1686..1b13b34 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -15,5 +15,5 @@ export const defaults:Options = {
components: allComponents,
icons: allIcons,
imports: allImports,
- extractStyle: true
+ extractStyle: false
}