菜单列表是 列表视图 的扩展。与通常的链接列表不同,菜单列表旨在指示应用程序的当前活动屏幕(或部分)。将其视为类似于 标签栏,但以列表形式呈现。
包含以下组件:
MenuList
- 菜单列表组件MenuListItem
- 菜单列表项元素MenuList
组件没有特定属性,但由于它扩展了 List
组件,因此它支持所有 List
属性
MenuListItem
组件扩展了 ListItem
组件,它支持所有 ListItem
属性,ListItem
插槽 以及以下附加属性:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
active | 布尔值 | false | 使菜单列表项突出显示(活动) |
href | 字符串 | 布尔值 | 菜单列表项链接的 | |
subtitle | 字符串 | 菜单列表项“子标题”区域的内容 |
<template><k-page><k-navbar title="Menu List" /><k-block strong><p>Menu list unlike usual links list is designed to indicate currentlyactive screen (or section) of your app. Think about it like a Tabbar butin a form of a list.</p></k-block><k-menu-list><k-menu-list-itemtitle="Home":active="selected === 'home'"@click="() => (selected = 'home')"><template #media><demo-icon /></template></k-menu-list-item><k-menu-list-itemtitle="Profile":active="selected === 'profile'"@click="() => (selected = 'profile')"><template #media><demo-icon /></template></k-menu-list-item><k-menu-list-itemtitle="Settings":active="selected === 'settings'"@click="() => (selected = 'settings')"><template #media><demo-icon /></template></k-menu-list-item></k-menu-list><k-menu-list><k-menu-list-itemtitle="Home"subtitle="Home subtitle":active="selectedMedia === 'home'"@click="() => (selectedMedia = 'home')"><template #media><demo-icon /></template></k-menu-list-item><k-menu-list-itemtitle="Profile"subtitle="Profile subtitle":active="selectedMedia === 'profile'"@click="() => (selectedMedia = 'profile')"><template #media><demo-icon /></template></k-menu-list-item><k-menu-list-itemtitle="Settings"subtitle="Settings subtitle":active="selectedMedia === 'settings'"@click="() => (selectedMedia = 'settings')"><template #media><demo-icon /></template></k-menu-list-item></k-menu-list></k-page></template><script>import { ref } from 'vue';import {kPage,kNavbar,kNavbarBackLink,kBlock,kMenuList,kMenuListItem,} from 'konsta/vue';import DemoIcon from '../components/DemoIcon.vue';export default {components: {kPage,kNavbar,kNavbarBackLink,kBlock,kMenuList,kMenuListItem,DemoIcon,},setup() {const selected = ref('home');const selectedMedia = ref('home');return {selected,selectedMedia,};},};</script>