Skip to main content

html+css+js (静态)

tabs栏.gif

van + vue3

<template>
<div class="mine-ask">
<van-tabs v-model:active="active">
<van-tab
:title="item.title"
v-for="item in componentList"
:key="item.comName"
>
<component :is="item.comName"></component>
</van-tab>
</van-tabs>
</div>
</template>

<script>
import {
shallowRef,
defineComponent,
getCurrentInstance,
reactive,
ref,
} from "vue";
import Child1 from "./components/Child1.vue";
import Child2 from "./components/Child2.vue";

export default defineComponent({
name: "",
// 注册你的组件
components: {
Child2,
Child1,
},
props: {},
emits: {},
setup(props, { attrs, slots, emit, expose }) {
const active = ref("");
return {
active,
componentList: [
{
title: "Child1",
comName: "Child1",
},
{
title: "Child2",
comName: "Child2",
},
],
};
},

methods: {},
});
</script>