mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-06 16:09:44 +08:00
docs(Grid): update document (#2046)
This commit is contained in:
parent
774d5d7897
commit
d249bdcce9
@ -1,5 +1,5 @@
|
|||||||
<van-tabbar active="{{ active }}" bind:change="onChange">
|
<van-tabbar active="{{ active }}" bind:change="onChange">
|
||||||
<van-tabbar-item wx:for="{{ list }}" wx:key="index" icon="{{ item.icon }}">{{
|
<van-tabbar-item wx:for="{{ list }}" wx:key="text" icon="{{ item.icon }}">
|
||||||
item.text
|
{{ item.text }}
|
||||||
}}</van-tabbar-item>
|
</van-tabbar-item>
|
||||||
</van-tabbar>
|
</van-tabbar>
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<van-checkbox-group value="{{ result }}" data-key="result" bind:change="onChange">
|
<van-checkbox-group value="{{ result }}" data-key="result" bind:change="onChange">
|
||||||
<van-checkbox
|
<van-checkbox
|
||||||
wx:for="{{ list }}"
|
wx:for="{{ list }}"
|
||||||
wx:key="{{ index }}"
|
wx:key="*this"
|
||||||
name="{{ item }}"
|
name="{{ item }}"
|
||||||
custom-class="demo-checkbox"
|
custom-class="demo-checkbox"
|
||||||
>
|
>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<van-checkbox-group value="{{ result2 }}" data-key="result2" max="2" bind:change="onChange">
|
<van-checkbox-group value="{{ result2 }}" data-key="result2" max="2" bind:change="onChange">
|
||||||
<van-checkbox
|
<van-checkbox
|
||||||
wx:for="{{ list }}"
|
wx:for="{{ list }}"
|
||||||
wx:key="{{ index }}"
|
wx:key="*this"
|
||||||
name="{{ item }}"
|
name="{{ item }}"
|
||||||
custom-class="demo-checkbox"
|
custom-class="demo-checkbox"
|
||||||
>
|
>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<van-cell-group >
|
<van-cell-group >
|
||||||
<van-cell
|
<van-cell
|
||||||
wx:for="{{ list }}"
|
wx:for="{{ list }}"
|
||||||
wx:key="{{ index }}"
|
wx:key="*this"
|
||||||
title="复选框{{ item }}"
|
title="复选框{{ item }}"
|
||||||
value-class="value-class"
|
value-class="value-class"
|
||||||
clickable
|
clickable
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
<demo-block title="基本用法">
|
<demo-block title="基本用法">
|
||||||
<van-grid>
|
<van-grid>
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 4 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 4 }}" wx:key="*this" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="自定义列数">
|
<demo-block title="自定义列数">
|
||||||
<van-grid column-num="3">
|
<van-grid column-num="3">
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 6 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 6 }}" wx:key="*this" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="自定义内容">
|
<demo-block title="自定义内容">
|
||||||
<van-grid column-num="3" border="{{ false }}">
|
<van-grid column-num="3" border="{{ false }}">
|
||||||
<van-grid-item use-slot wx:for="{{ 3 }}" wx:for-item="index">
|
<van-grid-item use-slot wx:for="{{ 3 }}" wx:for-item="index" wx:key="*this">
|
||||||
<image class="van-image" src="https://img.yzcdn.cn/vant/apple-{{ index+1 }}.jpg" />
|
<image style="width: 100%; height: 90px;" src="https://img.yzcdn.cn/vant/apple-{{ index + 1 }}.jpg" />
|
||||||
</van-grid-item>
|
</van-grid-item>
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="正方形格子">
|
<demo-block title="正方形格子">
|
||||||
<van-grid square>
|
<van-grid square>
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}" wx:key="*this" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="格子间距">
|
<demo-block title="格子间距">
|
||||||
<van-grid gutter="{{ 10 }}">
|
<van-grid gutter="{{ 10 }}">
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}" wx:key="*this" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="页面跳转">
|
<demo-block title="页面跳转">
|
||||||
<van-grid clickable column-num="2">
|
<van-grid clickable column-num="2">
|
||||||
<van-grid-item icon="home-o" link-type="navigateTo" url="/pages/dashboard/index" text="Navigate 跳转"></van-grid-item>
|
<van-grid-item icon="home-o" link-type="navigateTo" url="/pages/dashboard/index" text="Navigate 跳转" />
|
||||||
<van-grid-item icon="search" link-type="reLaunch" url="/pages/dashboard/index" text="ReLaunch 跳转"></van-grid-item>
|
<van-grid-item icon="search" link-type="reLaunch" url="/pages/dashboard/index" text="ReLaunch 跳转" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
@ -1,4 +1 @@
|
|||||||
.van-image {
|
/* empty */
|
||||||
width: 100%;
|
|
||||||
height: 90px;
|
|
||||||
}
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
| origin-price | 商品划线原价 | *string \| number* | - | - |
|
| origin-price | 商品划线原价 | *string \| number* | - | - |
|
||||||
| centered | 内容是否垂直居中 | *string* | `false` | - |
|
| centered | 内容是否垂直居中 | *string* | `false` | - |
|
||||||
| currency | 货币符号 | *string* | `¥` | - |
|
| currency | 货币符号 | *string* | `¥` | - |
|
||||||
| thumb-link | 点击左侧图片后的跳转链接 | *string* | - | - |
|
| thumb-link | 点击左侧图片后跳转的链接地址 | *string* | - | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
||||||
| lazy-load | 是否开启图片懒加载 | *boolean* | `false` | - |
|
| lazy-load | 是否开启图片懒加载 | *boolean* | `false` | - |
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
| size | 单元格大小,可选值为 `large` | *string* | - | - |
|
| size | 单元格大小,可选值为 `large` | *string* | - | - |
|
||||||
| border | 是否显示下边框 | *boolean* | `true` | - |
|
| border | 是否显示下边框 | *boolean* | `true` | - |
|
||||||
| center | 是否使内容垂直居中 | *boolean* | `false` | - |
|
| center | 是否使内容垂直居中 | *boolean* | `false` | - |
|
||||||
| url | 跳转链接 | *string* | - | - |
|
| url | 点击后跳转的链接地址 | *string* | - | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
||||||
| clickable | 是否开启点击反馈 | *boolean* | `false` | - |
|
| clickable | 是否开启点击反馈 | *boolean* | `false` | - |
|
||||||
| is-link | 是否展示右侧箭头并开启点击反馈 | *boolean* | `false` | - |
|
| is-link | 是否展示右侧箭头并开启点击反馈 | *boolean* | `false` | - |
|
||||||
|
@ -95,7 +95,7 @@ Page({
|
|||||||
| text | 按钮文字 | *string* | - | - |
|
| text | 按钮文字 | *string* | - | - |
|
||||||
| icon | 图标类型,可选值见`icon`组件 | *string* | - | - |
|
| icon | 图标类型,可选值见`icon`组件 | *string* | - | - |
|
||||||
| info | 图标右上角提示信息 | *string \| number* | - | - |
|
| info | 图标右上角提示信息 | *string \| number* | - | - |
|
||||||
| url | 跳转链接 | *string* | - | - |
|
| url | 点击后跳转的链接地址 | *string* | - | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
||||||
| id | 标识符 | *string* | - | - |
|
| id | 标识符 | *string* | - | - |
|
||||||
| disabled | 是否禁用按钮 | *boolean* | `false` | - |
|
| disabled | 是否禁用按钮 | *boolean* | `false` | - |
|
||||||
@ -115,7 +115,7 @@ Page({
|
|||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| text | 按钮文字 | *string* | - | - |
|
| text | 按钮文字 | *string* | - | - |
|
||||||
| color | 按钮颜色,支持传入 `linear-gradient` 渐变色 | *string* | - | - |
|
| color | 按钮颜色,支持传入 `linear-gradient` 渐变色 | *string* | - | - |
|
||||||
| url | 跳转链接 | *string* | - | - |
|
| url | 点击后跳转的链接地址 | *string* | - | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
||||||
| id | 标识符 | *string* | - | - |
|
| id | 标识符 | *string* | - | - |
|
||||||
| type | 按钮类型,可选值为 `primary` `warning` `danger` | *string* | `default` | - |
|
| type | 按钮类型,可选值为 `primary` `warning` `danger` | *string* | `default` | - |
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-grid>
|
<van-grid>
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 4 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" />
|
||||||
|
<van-grid-item icon="photo-o" text="文字" />
|
||||||
|
<van-grid-item icon="photo-o" text="文字" />
|
||||||
|
<van-grid-item icon="photo-o" text="文字" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -33,7 +36,7 @@
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-grid column-num="3">
|
<van-grid column-num="3">
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 6 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 6 }}" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -45,8 +48,8 @@
|
|||||||
<van-grid column-num="3" border="{{ false }}">
|
<van-grid column-num="3" border="{{ false }}">
|
||||||
<van-grid-item use-slot wx:for="{{ 3 }}" wx:for-item="index">
|
<van-grid-item use-slot wx:for="{{ 3 }}" wx:for-item="index">
|
||||||
<image
|
<image
|
||||||
class="van-image"
|
style="width: 100%; height: 90px;"
|
||||||
src="https://img.yzcdn.cn/vant/apple-{{ index+1 }}.jpg"
|
src="https://img.yzcdn.cn/vant/apple-{{ index + 1 }}.jpg"
|
||||||
/>
|
/>
|
||||||
</van-grid-item>
|
</van-grid-item>
|
||||||
</van-grid>
|
</van-grid>
|
||||||
@ -58,7 +61,7 @@
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-grid square>
|
<van-grid square>
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -68,7 +71,7 @@
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-grid gutter="{{ 10 }}">
|
<van-grid gutter="{{ 10 }}">
|
||||||
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}"></van-grid-item>
|
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 8 }}" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -82,14 +85,14 @@
|
|||||||
icon="home-o"
|
icon="home-o"
|
||||||
link-type="navigateTo"
|
link-type="navigateTo"
|
||||||
url="/pages/dashboard/index"
|
url="/pages/dashboard/index"
|
||||||
text="Navigate跳转"
|
text="Navigate 跳转"
|
||||||
></van-grid-item>
|
/>
|
||||||
<van-grid-item
|
<van-grid-item
|
||||||
icon="search"
|
icon="search"
|
||||||
link-type="reLaunch"
|
link-type="reLaunch"
|
||||||
url="/pages/dashboard/index"
|
url="/pages/dashboard/index"
|
||||||
text="ReLaunch跳转"
|
text="ReLaunch 跳转"
|
||||||
></van-grid-item>
|
/>
|
||||||
</van-grid>
|
</van-grid>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -97,35 +100,35 @@
|
|||||||
|
|
||||||
### Grid Props
|
### Grid Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||||
| ---------- | ------------------------------ | ------------------ | ------- | ---- |
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| column-num | 列数 | *number* | `4` | - |
|
| column-num | 列数 | *number* | `4` | - |
|
||||||
| gutter | 格子之间的间距,默认单位为`px` | *string \| number* | `0` | - |
|
| gutter | 格子之间的间距,默认单位为`px` | *string \| number* | `0` | - |
|
||||||
| border | 是否显示边框 | *boolean* | `true` | - |
|
| border | 是否显示边框 | *boolean* | `true` | - |
|
||||||
| center | 是否将格子内容居中显示 | *boolean* | `true` | - |
|
| center | 是否将格子内容居中显示 | *boolean* | `true` | - |
|
||||||
| square | 是否将格子固定为正方形 | *boolean* | `false` | - |
|
| square | 是否将格子固定为正方形 | *boolean* | `false` | - |
|
||||||
| clickable | 是否开启格子点击反馈 | *boolean* | `false` | - |
|
| clickable | 是否开启格子点击反馈 | *boolean* | `false` | - |
|
||||||
| use-slot | 是否使用自定义内容的插槽 | *boolean* | `false` |
|
| use-slot | 是否使用自定义内容的插槽 | *boolean* | `false` |
|
||||||
|
|
||||||
### GridItem Props
|
### GridItem Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||||
| --------- | ---------------------------------------------------------- | -------- | ------------ | ---- |
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| text | 文字 | *string* | - | - |
|
| text | 文字 | *string* | - | - |
|
||||||
| icon | 图标名称或图片链接,可选值见 [Icon 组件](/#/icon) | *string* | - | - |
|
| icon | 图标名称或图片链接,可选值见 [Icon 组件](/#/icon) | *string* | - | - |
|
||||||
| url | 跳转链接 | *string* | - | - |
|
| url | 点击后跳转的链接地址 | *string* | - | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | *string* | `navigateTo` | - |
|
||||||
|
|
||||||
### GridItem Events
|
### GridItem Events
|
||||||
|
|
||||||
| 事件名 | 说明 | 回调参数 |
|
| 事件名 | 说明 | 回调参数 |
|
||||||
| ---------- | -------------- | -------- |
|
|-----------|-----------|-----------|
|
||||||
| bind:click | 点击格子时触发 | - |
|
| bind:click | 点击格子时触发 | - |
|
||||||
|
|
||||||
### GridItem Slots
|
### GridItem Slots
|
||||||
|
|
||||||
| 名称 | 说明 |
|
| 名称 | 说明 |
|
||||||
| ------- | ---------------------------------------------------- |
|
|-----------|-----------|
|
||||||
| default | 自定义宫格的所有内容,需要设置`use-slot`属性 |
|
| default | 自定义宫格的所有内容,需要设置`use-slot`属性 |
|
||||||
| icon | 自定义图标,如果设置了`use-slot`或者`icon`属性则不生效 |
|
| icon | 自定义图标,如果设置了`use-slot`或者`icon`属性则不生效 |
|
||||||
| text | 自定义文字,如果设置了`use-slot`或者`text`属性则不生效 |
|
| text | 自定义文字,如果设置了`use-slot`或者`text`属性则不生效 |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user