布局-九宫格
基础用法
html
<template>
<view class="rsgrid">
<view class="jp-bg-gap title">九宫格:支持列数自定义,支持占位图</view>
<jp-grid
:pictures="attribute.dataArr"
:column="4"
error-img="/static/example/ic_template.png"
></jp-grid>
</view>
</template>
<script lang="ts" setup>
import { reactive } from "vue"
const attribute = reactive({
dataArr: [
{
img: "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3279463813,881319902&fm=26&gp=0.jpg",
name: "测试1",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试2",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试3",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试4",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试5",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试6",
},
{
img: "http://img2.imgtn.bdimg.com/it/u=3035889490,728308378&fm=15&gp=0.jpg",
name: "测试7",
},
{ img: "http://img2.imgtn.bdimg.com/it/u=303588949", name: "测试8" },
],
})
</script>
<style scoped lang="scss">
.rsgrid {
padding: 12px;
.title {
margin-top: 12px;
padding: 12px;
font-size: 14px;
color: #666;
}
}
</style>
props
属性名 | 类型 | 默认值 | 描述 |
---|---|---|---|
pictures | Array | [] | |
column | Number | 4 | |
imageKey | String | 'attachmentPath' | 图片映射的键 |
textKey | String | 'typeName' | 文字说明映射的键 |
errorImg | String | '' |
事件名 |
---|
do-click |