Skip to content

Commit 1cf7fe2

Browse files
authored
docs: prop validation (#792)
1 parent 8fd65ed commit 1cf7fe2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

questions/323-prop-validation/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,16 @@
33

44
Please validate the `type` prop of the `Button` component. it's accept the following strings `primary | ghost | dashed | link | text | default` only and the default value is `default`.
55

6+
```vue
7+
<script setup>
8+
defineProps({
9+
type: {},
10+
})
11+
</script>
12+
13+
<template>
14+
<button>Button</button>
15+
</template>
16+
```
617

718
<!--info-footer-start--><br><a href="../../README.md" target="_blank"><img src="https://img.shields.io/badge/-Back-grey" alt="Back"/></a> <a href="https://github.com/webfansplz/vuejs-challenges/issues/new?labels=answer,en&template=0-answer.md&title=323%20-%20Prop%20Validation" target="_blank"><img src="https://img.shields.io/badge/-Share%20your%20Solutions-teal" alt="Share your Solutions"/></a> <a href="https://github.com/webfansplz/vuejs-challenges/issues?q=label%3A323+label%3Aanswer" target="_blank"><img src="https://img.shields.io/badge/-Check%20out%20Solutions-de5a77?logo=awesome-lists&logoColor=white" alt="Check out Solutions"/></a> <!--info-footer-end-->

questions/323-prop-validation/README.zh-CN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@
33

44
请验证`Button`组件的`Prop`类型 ,使它只接收: `primary | ghost | dashed | link | text | default` ,且默认值为`default`
55

6+
```vue
7+
<script setup>
8+
defineProps({
9+
type: {},
10+
})
11+
</script>
12+
13+
<template>
14+
<button>Button</button>
15+
</template>
16+
```
17+
618
<!--info-footer-start--><br><a href="../../README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E8%BF%94%E5%9B%9E%E9%A6%96%E9%A1%B5-grey" alt="返回首页"/></a> <a href="https://github.com/webfansplz/vuejs-challenges/issues/new?labels=answer,zh-CN&template=1-answer.zh-CN.md&title=323%20-%20Prop%E9%AA%8C%E8%AF%81" target="_blank"><img src="https://img.shields.io/badge/-%E5%88%86%E4%BA%AB%E4%BD%A0%E7%9A%84%E8%A7%A3%E7%AD%94-teal" alt="分享你的解答"/></a> <a href="https://github.com/webfansplz/vuejs-challenges/issues?q=label%3A323+label%3Aanswer" target="_blank"><img src="https://img.shields.io/badge/-%E6%9F%A5%E7%9C%8B%E8%A7%A3%E7%AD%94-de5a77?logo=awesome-lists&logoColor=white" alt="查看解答"/></a> <!--info-footer-end-->

0 commit comments

Comments
 (0)