前言:哈喽,大家好,今天给大家分享一篇文章!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦
️✍️️️️⚠️⬇️·正文开始
⬇️·✅❓ 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣*️⃣#️⃣
<template>
<div class="table-demo">
<h2>6. 自定义导出文件名示例h2>
<p class="description">使用 export-file-name 自定义导出文件名p>
<div class="table-container">
<Table
:data="customers"
:columns="columns"
show-export
export-button-text="导出会员数据"
export-file-name="VIP会员列表"
/>
div>
div>
template>
<script setup>
import {
ref } from 'vue'
import Table from '@/components/Table/Table.vue'
const customers = ref([
{
id: 1, name: '张三', age: 28, city: '北京', level: '黄金' },
{
id: 2, name: '李四', age: 35, city: '上海', level: '白银' },
{
id: 3, name: '王五', age: 42, city: '广州', level: '铂金' },
{
id: 4, name: '赵六', age: 31, city: '深圳', level: '黄金' },
{
id: 5, name: '钱七', age: 29, city: '杭州', level: '白银' }
])
const columns = ref([
{
title: '姓名', dataIndex: 'name', width: '120px' },
{
title: '年龄', dataIndex: 'age', width: '80px' },
{
title: '城市', dataIndex: 'city', width: '120px' },
{
title: '会员等级', dataIndex: 'level', width: '120px' }
])
script>
<style scoped>
.table-demo {
padding: 20px;
}
.description {
margin: 16px 0;
color: #666;
}
.table-container {
border: 1px solid #ebeef5;
border-radius: 4px;
}
style>
运行正常
import {
createRouter, createWebHistory } from 'vue-router'
import RightClickMenuView from '../views/RightClickMenuView.vue'
import RangePickerView from '../views/RangePickerView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'progress',
component: () => import('../views/ProgressView.vue'),
},
{
path: '/tabs',
name: 'tabs',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
// 标签页(Tabs)
component: () => import('../views/TabsView.vue'),
},
{
path: '/accordion',
name: 'accordion',
// 折叠面板(Accordion)
component: () => import('../views/AccordionView.vue'),
},
{
path: '/timeline',
name: 'timeline',
// 时间线(Timeline)
component: () => import('../views/TimelineView.vue'),
},
{
path: '/backToTop',
name: 'backToTop',
component: () => import('../views/BackToTopView.vue')
},
{
path: '/notification',
name: 'notification',
component: () => import('../views/NotificationView.vue')
},
{
path: '/card',
name: 'card',
component: () => import('../views/CardView.vue')
},
{
path: '/infiniteScroll',
name: 'infiniteScroll',
component: () => import('../views/InfiniteScrollView.vue')
},
{
path: '/switch',
name: 'switch',
component: () => import('../views/SwitchView.vue')
},
{
path: '/sidebar',
name: 'sidebar',
component: () => import('../views/SidebarView.vue')
},
{
path: '/breadcrumbs',
name: 'breadcrumbs',
component: () => import('../views/BreadcrumbsView.vue')
},
{
path: '/masonryLayout',
name: 'masonryLayout',
component: () => import('../views/MasonryLayoutView.vue')
},
{
path: '/rating',
name: 'rating',
component: () =>