ScrollList (滑动列表)
滑动列表组件允许用户通过滑动来浏览列表项,支持自定义指示器
支持平台
安卓 | ios | 鸿蒙 | web | 微信小程序 |
---|---|---|---|---|
√ | √ | √ | √ | √ |
示例代码
html
<template>
<t-page>
<t-card main-class="mlrt-30" title="ScrollList 滑动列表" sub-title="滑动组件提供水平滚动功能,支持自定义指示器样式,兼容PC环境鼠标滑动">
</t-card>
<introduction title="基础功能">
<t-scroll-list>
<template v-for="(item,index) in list1" :key="index">
<t-image :src="`/pagesA/static/image/goods/${item.thumb}`" main-class="twh-150 mr-20"></t-image>
</template>
</t-scroll-list>
</introduction>
<introduction title="设置指示器">
<t-scroll-list indicator-class="w-200 h-15 bg-rgba(245,108,108,0.2)"
indicator-bar-class="bg-#f56c6c h-15 w-80">
<template v-for="(item,index) in list1" :key="index">
<t-image :src="`/pagesA/static/image/goods/${item.thumb}`" main-class="twh-150-mr-20"></t-image>
</template>
</t-scroll-list>
</introduction>
<introduction title="不显示指示器">
<t-scroll-list :indicator="false">
<template v-for="(item,index) in list1" :key="index">
<t-image :src="`/pagesA/static/image/goods/${item.thumb}`" main-class="twh-150-mr-20"></t-image>
</template>
</t-scroll-list>
</introduction>
<introduction title="宫格">
<t-scroll-list>
<t-grid :column="4" main-class="w-690">
<t-grid-item v-for="i in 8" :key="i" :icon="`/pagesA/static/grid/grid (${i}).png`"
:label="`功能${i}`"></t-grid-item>
</t-grid>
<t-grid :column="4" main-class="w-690">
<t-grid-item v-for="i in 8" :key="i" :icon="`/pagesA/static/grid/grid (${i}).png`"
:label="`功能${i+8}`"></t-grid-item>
</t-grid>
</t-scroll-list>
</introduction>
</t-page>
</template>
<script>
type testScrollList = {
price : string,
thumb : string
}
export default {
data() {
return {
list: [{
price: '手机',
thumb: '4.png'
}, {
price: '数码',
thumb: '6.png'
}, {
price: '食品',
thumb: '3.png'
}, {
price: '电器',
thumb: '2.png'
}, {
price: '百货',
thumb: '7.png'
}, {
price: '男装',
thumb: '1.png'
}, {
price: '家具',
thumb: '8.png'
}, {
price: '鞋包',
thumb: '5.png'
}] as testScrollList[],
list1: [{
price: '¥230.5',
thumb: '1.jpg'
}, {
price: '¥74.1',
thumb: '2.jpg'
}, {
price: '¥8457',
thumb: '3.jpg'
}, {
price: '¥1442',
thumb: '4.jpg'
}, {
price: '¥234',
thumb: '5.jpg'
}, {
price: '¥562',
thumb: '6.jpg'
}, {
price: '¥251.5',
thumb: '7.jpg'
}] as testScrollList[]
};
},
created() {}
}
</script>
属性
名称 | 类型 | 默认值 | 说明 | 可选值 |
---|---|---|---|---|
size | String | mini | 组件尺寸 | large(大尺寸), medium(中尺寸), small(小尺寸), mini(迷你) |
type | String | "" | 组件类型 | info(信息), primary(正常), error(错误), warning(警告), success(成功) |
disabled | Boolean | false | 组件是否禁用 | false, true |
stop | Boolean | false | 是否阻止事件冒泡(Tui统一写法处理事件冒泡) | false, true |
hover | Boolean | true | 是否有点击效果 | false, true |
path | String | "" | 点击组件后跳转的页面路径,如果为空则响应点击事件,如果不为空则跳转页面不会响应单击事件。 | - |
mainClass | String | "" | 组件根节点的样式 | - |
nativeClass | String | "" | 组件根节点原生样式 | - |
effect | String | "normal" | 组件显示主题 | normal(正常), dark(深色), light(浅色), plain(镂空) |
type | String | p | ||
indicator | Boolean | true | 是否显示指示器 |
插槽
名称 | 返回值 | 说明 |
---|---|---|
default | - |