Files
dvcp_v2_wxcp_app/src/components/AiTreePath.vue

46 lines
1.0 KiB
Vue
Raw Normal View History

2023-05-25 14:54:46 +08:00
<template>
<section class="AiTreePath">
2023-05-25 15:06:40 +08:00
<AiTreePath v-if="parent" v-bind="$props" :node="parent" v-on="$listeners"/>
<b v-else v-text="`全部`" @click="$emit('click','all')"/>
2023-05-25 14:54:46 +08:00
<u-icon v-if="label" name="arrow-right" size="32" color="#ccc"/>
2023-05-25 15:06:40 +08:00
<div :class="{active}" v-text="label" @click="$emit('click',node)"/>
2023-05-25 14:54:46 +08:00
</section>
</template>
<script>
export default {
name: "AiTreePath",
props: {
current: {default: null},
prop: {default: () => ({})},
2023-05-25 15:06:40 +08:00
paths: {default: () => []},
node: {default: null}
2023-05-25 14:54:46 +08:00
},
computed: {
options: v => ({
id: 'id',
label: 'name',
parent: 'parentId',
...v.prop
}),
2023-05-25 15:06:40 +08:00
label: v => v.node?.[v.options.label] || "",
parent: v => v.paths?.[v.node?.[v.options.parent]],
active: v => v.node?.[v.options.id] == v.current
2023-05-25 14:54:46 +08:00
}
}
</script>
<style scoped lang="scss">
.AiTreePath {
display: flex;
align-items: center;
gap: 8px;
font-size: 36px;
line-height: 40px;
font-family: PingFang-SC;
2023-05-25 15:06:40 +08:00
.active {
font-weight: bold;
color: #26f
}
2023-05-25 14:54:46 +08:00
}
</style>