Skip to content

Commit 10849bb

Browse files
Script Setup Edits for Clarity (#1194)
* Second-person consistency * Edit defineProps and defineEmits for clarity * Update src/api/sfc-script-setup.md Co-authored-by: skirtle <[email protected]> Co-authored-by: skirtle <[email protected]>
1 parent 4d74544 commit 10849bb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/api/sfc-script-setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Think of `MyComponent` as being referenced as a variable. If you have used JSX,
8989

9090
### Dynamic Components
9191

92-
Since components are referenced as variables instead of registered under string keys, we should use dynamic `:is` binding when using dynamic components inside `<script setup>`:
92+
Since components are referenced as variables instead of registered under string keys, you should use dynamic `:is` binding when using dynamic components inside `<script setup>`:
9393

9494
```vue
9595
<script setup>
@@ -133,7 +133,7 @@ import * as Form from './form-components'
133133

134134
## `defineProps` and `defineEmits`
135135

136-
To declare options like `props` and `emits` with full type inference support, we can use the `defineProps` and `defineEmits` APIs, which are automatically available inside `<script setup>`:
136+
To declare `props` and `emits` in `<script setup>`, you must use the `defineProps` and `defineEmits` APIs, which provide full type inference support and are automatically available inside `<script setup>`:
137137

138138
```vue
139139
<script setup>
@@ -148,7 +148,7 @@ const emit = defineEmits(['change', 'delete'])
148148

149149
- `defineProps` and `defineEmits` are **compiler macros** only usable inside `<script setup>`. They do not need to be imported, and are compiled away when `<script setup>` is processed.
150150

151-
- `defineProps` accepts the same value as the `props` option, while `defineEmits` accepts the same value as the `emits` option.
151+
- `defineProps` accepts the same value as the [`props` option](/api/options-data.html#props), while `defineEmits` accepts the same value as the [`emits` option](/api/options-data.html#emits).
152152

153153
- `defineProps` and `defineEmits` provide proper type inference based on the options passed.
154154

@@ -195,7 +195,7 @@ const attrs = useAttrs()
195195

196196
## Usage alongside normal `<script>`
197197

198-
`<script setup>` can be used alongside normal `<script>`. A normal `<script>` may be needed in cases where we need to:
198+
`<script setup>` can be used alongside normal `<script>`. A normal `<script>` may be needed in cases where you need to:
199199

200200
- Declare options that cannot be expressed in `<script setup>`, for example `inheritAttrs` or custom options enabled via plugins.
201201
- Declaring named exports.

0 commit comments

Comments
 (0)