Skip to content

Commit

Permalink
docs: ✏️ 常见问题添加Vue 3.3+使用defineOptions设置styleIsolation规则的介绍
Browse files Browse the repository at this point in the history
Closes: #784
  • Loading branch information
Moonofweisheng committed Dec 15, 2024
1 parent 1fd0a27 commit f3bee13
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions docs/guide/common-problems.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>
```

Expand Down

0 comments on commit f3bee13

Please sign in to comment.