mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Doc] add props name style guide (#366)
This commit is contained in:
parent
dd25e2c184
commit
78789c6d21
@ -58,3 +58,15 @@ Vue.use(Vant);
|
||||
<!-- import script -->
|
||||
<script src="https://unpkg.com/vant/lib/vant.min.js"></script>
|
||||
```
|
||||
|
||||
### Props Named Style
|
||||
HTML attributes are case-insensitive, so when using non-string templates, camelCased prop names need to use their kebab-case (hyphen-delimited) equivalents.
|
||||
|
||||
``` html
|
||||
<!-- camelCase in JavaScript -->
|
||||
<van-cell isLink />
|
||||
|
||||
<!-- kebab-case in HTML -->
|
||||
<van-cell is-link />
|
||||
```
|
||||
|
||||
|
@ -65,3 +65,15 @@ Vue.use(Vant);
|
||||
```shell
|
||||
vue init youzan/vue-cli-template-vant projectName
|
||||
```
|
||||
|
||||
### Props 命名风格
|
||||
Vant 文档中的 props 默认采用驼峰式命名 (camelCase)。由于 HTML 特性是不区分大小写的,如果在 HTML 中直接书写 Vue 模板,需要使用短横线分割式 (kebab-case) 的命名来传递 props
|
||||
|
||||
``` html
|
||||
<!-- 在 JavaScript 中使用 camelCase -->
|
||||
<van-cell isLink />
|
||||
|
||||
<!-- 在 HTML 中使用 kebab-case-->
|
||||
<van-cell is-link />
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user