-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: ✏️ 常见问题添加Vue 3.3+使用defineOptions设置styleIsolation规则的介绍
✅ Closes: #784
- Loading branch information
1 parent
1fd0a27
commit f3bee13
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,14 +58,18 @@ pnpm add [email protected] -D | |
<wd-button type="primary">主要按钮</wd-button> | ||
``` | ||
|
||
`Vue 3.2` 及以下版本可以使用如下配置开启`styleIsolation: 'shared'`选项: | ||
```ts | ||
// vue | ||
<script lang="ts"> | ||
export default { | ||
options: { | ||
styleIsolation: 'shared' | ||
} | ||
} | ||
</script> | ||
<script lang="ts" setup> | ||
</script> | ||
``` | ||
|
||
```scss | ||
|
@@ -74,21 +78,14 @@ export default { | |
color: red !important; | ||
} | ||
``` | ||
|
||
什么?还有人想问:这样写还我怎么使用`script setup`啊! | ||
|
||
**_简单,这样写两个就行了_** | ||
|
||
`Vue 3.3+` 可以通过`defineOptions`开启`styleIsolation: 'shared'`选项: | ||
```ts | ||
<script lang="ts"> | ||
export default { | ||
<script lang="ts" setup> | ||
defineOptions({ | ||
options: { | ||
styleIsolation: 'shared' | ||
} | ||
} | ||
</script> | ||
|
||
<script lang="ts" setup> | ||
}) | ||
</script> | ||
``` | ||
|
||
|