mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 09:08:51 +08:00
docs: ✏️ 常见问题添加Vue 3.3+使用defineOptions设置styleIsolation规则的介绍
✅ Closes: #784
This commit is contained in:
parent
1fd0a27788
commit
f3bee13b46
@ -58,7 +58,9 @@ pnpm add sass@1.78.0 -D
|
||||
<wd-button type="primary">主要按钮</wd-button>
|
||||
```
|
||||
|
||||
`Vue 3.2` 及以下版本可以使用如下配置开启`styleIsolation: 'shared'`选项:
|
||||
```ts
|
||||
// vue
|
||||
<script lang="ts">
|
||||
export default {
|
||||
options: {
|
||||
@ -66,6 +68,8 @@ export default {
|
||||
}
|
||||
}
|
||||
</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>
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user