Skip to content
On this page

Breadcrumb 面包屑

基本使用

Code
vue
<script setup lang="ts">
const routes = [
  {
    path: "/first", // 路由地址
    query: { id: 1, tab: 2 }, // 路由参数
    name: "一级路由", // 路由名称
  },
  {
    path: "/second",
    name: "二级路由",
  },
  {
    path: "/third",
    name: "三级路由三级路由三级路由三级路由",
  },
]
</script>
<template>
  <q-breadcrumb :routes="routes" />
</template>

自定义分隔符

Code
vue
<script setup lang="ts">
const routes = [
  {
    path: "/first", // 路由地址
    query: { id: 1, tab: 2 }, // 路由参数
    name: "一级路由", // 路由名称
  },
  {
    path: "/second",
    name: "二级路由",
  },
  {
    path: "/third",
    name: "三级路由三级路由三级路由三级路由",
  },
]
</script>
<template>
  <q-breadcrumb :routes="routes" separator="/" />
</template>

自定义样式

Code
vue
<script setup lang="ts">
const routes = [
  {
    path: "/first", // 路由地址
    query: { id: 1, tab: 2 }, // 路由参数
    name: "一级路由", // 路由名称
  },
  {
    path: "/second",
    name: "二级路由",
  },
  {
    path: "/third",
    name: "三级路由三级路由三级路由三级路由三级路由",
  },
]
</script>
<template>
  <q-breadcrumb :routes="routes" :font-size="16" />
</template>

新页面打开目标链接

Code
vue
<script setup lang="ts">
const routes = [
  {
    path: "/first", // 路由地址
    query: { id: 1, tab: 2 }, // 路由参数
    name: "一级路由", // 路由名称
  },
  {
    path: "/second",
    name: "二级路由",
  },
  {
    path: "/third",
    name: "三级路由三级路由三级路由三级路由",
  },
]
</script>
<template>
  <q-breadcrumb :routes="routes" target="_blank" />
</template>

APIs

参数说明类型默认值必传
routes路由数组Route[][]true
fontSize字体大小,单位 pxnumber14false
height面包屑高度number36false
maxWidth文本最大显示宽度,超出后显示省略号,单位 px150false
separator分隔符,默认''时为箭头string''false
target在何处打开目标 URL'_self' | '_blank''_self'false

Route Type

名称说明类型必传
path路由地址stringtrue
query路由查询参数[propName: string]: anyfalse
name路由名称stringtrue

License