SliderMenu (侧边分类)
布局灵活,适配任何数据格式,组件内部使用list-view内存回收无需担心数据太多的性能问题,采用了逐帧渲染技术,解决listview首次加载慢的问题,左侧列表使用的虚拟滚动技术
支持平台
安卓 | ios | 鸿蒙 | web | 微信小程序 |
---|---|---|---|---|
√ | √ | √ | √ | √ |
示例代码
html
<template>
<t-page main-class="p-30">
<t-card main-class='mb-30' title="侧边分类"
sub-title="布局灵活,适配任何数据格式,组件内部使用list-view内存回收无需担心数据太多的性能问题,采用了逐帧渲染技术,解决listview首次加载慢的问题,左侧列表使用的虚拟滚动技术"></t-card>
<t-section title="插槽用法" main-class="mb-30"></t-section>
<t-slider-menu main-class="mb-30 tdr" :list="list">
<template v-slot:default="{item}">
<t-col main-class="p-20">
<t-text main-class="mb-20 sfwb">{{(item as SlidetMenuListType).title}}</t-text>
<t-row v-for="(itemL,_) in (item as SlidetMenuListType).data" main-class="mb-30 tdr tdb ptb-20"
:key="itemL.goods_id">
<t-image :src="itemL.goods_img" main-class='twh-120 mr-10'></t-image>
<t-col main-class="f">
<t-text>{{itemL.goods_name}}</t-text>
<t-text type="error" main-class="slh-40">{{itemL.shop_price}}</t-text>
</t-col>
</t-row>
</t-col>
<t-row main-class="h-20"></t-row>
</template>
</t-slider-menu>
</t-page>
</template>
<script>
import { getSidebarMenulist, SlidetMenuListType, SlidetMenuListGoodsType, SlidetMenuListResponse } from '@/api'
export default {
data() {
return {
activeIndex: 0,
list: [] as SlidetMenuListType[],
goods: [] as SlidetMenuListGoodsType[]
};
},
methods: {
currentChange(cur : number) {
this.activeIndex = cur
},
isactive(index : any) {
return `${index}` == `${this.activeIndex}`
}
},
onLoad() {
getSidebarMenulist({}).then((res : SlidetMenuListResponse) => {
this.list = res.data
})
}
}
</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(镂空) |
virtualRowHeight | Number | 45 | 左侧菜单的行高 | |
list | any[] | [] | 数据源 | |
current | Number | 1 | 当前滚动位置的索引 | |
titleKey | String | title | 标题显示字段的key |
事件
名称 | 返回参数 | 说明 |
---|---|---|
change | (e:number) | 滚动位置发生变体时触发 返回滚动位置项的索引 |
插槽
名称 | 返回值 | 说明 |
---|---|---|
default | - |