65 lines
1.2 KiB
Vue
Raw Normal View History

2022-01-05 18:04:41 +08:00
<template>
2022-01-05 20:52:49 +08:00
<n-space class="header-left-btn">
2022-01-05 18:04:41 +08:00
<n-tooltip
v-for="item in btnList"
:key="item.title"
placement="bottom"
trigger="hover"
>
<template #trigger>
2022-01-05 20:52:49 +08:00
<n-button type="info" size="small" ghost @click="item.fn">
2022-01-05 18:04:41 +08:00
<component :is="item.icon"></component>
</n-button>
</template>
<span>
{{ item.title }}
</span>
</n-tooltip>
</n-space>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { renderIcon } from '@/utils'
2022-01-05 20:52:49 +08:00
import { icon } from '@/plugins'
const { LayersIcon, BarChartIcon, PrismIcon } = icon.ionicons5
const layers = () => {
console.log('选择了图层控制')
}
const charts = () => {
console.log('选择了图表组件')
}
const details = () => {
console.log('选择了详情')
}
2022-01-05 18:04:41 +08:00
const btnList = reactive([
{
2022-01-05 20:52:49 +08:00
fn: layers,
2022-01-05 18:04:41 +08:00
select: true,
title: '图层控制',
2022-01-05 20:52:49 +08:00
icon: renderIcon(LayersIcon)
2022-01-05 18:04:41 +08:00
},
{
2022-01-05 20:52:49 +08:00
fn: charts,
2022-01-05 18:04:41 +08:00
select: true,
title: '图表组件',
icon: renderIcon(BarChartIcon)
2022-01-05 20:52:49 +08:00
},
{
fn: details,
select: true,
title: '详情设置',
icon: renderIcon(PrismIcon)
2022-01-05 18:04:41 +08:00
}
])
</script>
2022-01-05 20:52:49 +08:00
<style lang="scss" scoped>
.header-left-btn {
padding-right: 212px;
}
</style>