<Tabbar v-model="active">
<TabbarItem>
<span>自定义</span>
<template #icon="props">
<img :src="props.active ? icon.active : icon.inactive" />
</template>
</TabbarItem>
</Tabbar>
<script setup>
import { ref, reactive } from 'vue';
const active = ref(0)
const icon = reactive({
active: getAssetsImage('图片1.png'),
inactive: getAssetsImage('图片2.png'),
})
function getAssetsImage(name: string) {
return new URL(`/src/assets/tabbar/${name}`, import.meta.url).href
}
</script>
vue3 + vite + vant tabbar引入图片问题
最新推荐文章于 2024-06-13 16:15:02 发布