tab.vue.hbs 724 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <script setup>
  2. import { ref } from 'vue';
  3. import { useRouter,useRoute } from 'vue-router'
  4. const router = useRouter()
  5. const route = useRoute()
  6. // #region (props)
  7. // {{props}}
  8. {{#if props}}
  9. const props = defineProps<{
  10. {{#each props}}
  11. {{this}}: string,
  12. {{/each}}
  13. }>()
  14. {{/if}}
  15. // #endregion
  16. function handleTabChange(name) {
  17. router.push({ name })
  18. }
  19. const activeName = ref(route.name)
  20. </script>
  21. <template>
  22. <div class="w-full h-full">
  23. <div class="card mb-2">
  24. <el-tabs v-model="activeName" @tab-change="handleTabChange">
  25. {{#each tab_list}}
  26. <el-tab-pane label="{{title}}" name="{{name}}"></el-tab-pane>
  27. {{/each}}
  28. </el-tabs>
  29. </div>
  30. <router-view />
  31. </div>
  32. </template>