前言:哈喽,大家好,今天给大家分享一篇文章!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦 💕
目录
📚📗📕📘📖🕮💡📝🗂️✍️🛠️💻🚀🎉🏗️🌐🖼️🔗📊👉🔖⚠️🌟🔐⬇️·正文开始
⬇️·🎥😊🎓📩😺🌈🤝🤖📜📋🔍✅🧰❓📄📢📈 🙋0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟🆗*️⃣#️⃣
DeepSeek 助力 Vue3 开发:打造丝滑的表格(Table)之添加行拖拽排序功能
📚前言
2023 年 11 月 2 日,DeepSeek 发布首个开源代码大模型 DeepSeek Coder,犹如一颗重磅炸弹,在开发者社区引起了强烈反响。该模型支持多种编程语言的代码生成、调试和数据分析任务,为开发者们提供了强大的助力。它能够根据开发者的需求和描述,快速生成高质量的代码片段,大大提高了开发效率,减少了开发时间和成本。在开发一个简单的 Web 应用时,开发者只需输入相关的功能需求和技术框架,DeepSeek Coder 就能迅速生成相应的代码框架和核心代码,帮助开发者快速搭建起项目的基础架构,让开发者能够将更多的精力投入到业务逻辑的实现和优化中。
📚页面效果
📚指令输入
添加行拖拽排序功能
📚think
好的,我需要为用户添加行拖拽排序功能到他们的Vue3表格组件中。首先,我得回顾一下现有的代码结构,确保新功能的整合不会破坏已有的功能,比如加载状态、列宽调整、导出数据等。
用户的需求是实现行的拖拽排序,这意味着用户可以通过拖拽表格的行来重新排列数据的顺序。这需要在前端处理拖拽事件,并更新数据顺序,同时可能需要将新的顺序反馈到父组件。
首先,我需要考虑如何实现拖拽的交互。HTML5有原生的拖放API,但可能在移动端兼容性不好,或者使用第三方库如Sortable.js。不过,为了保持轻量,可能优先考虑使用原生事件。
接下来,拖拽过程中需要处理的事件包括:dragstart、dragover、dragend等。在Vue中,可以通过事件监听器来绑定这些事件。当用户开始拖拽某一行时,记录被拖拽的行索引;当拖拽到另一行时,交换两者的位置;拖拽结束时,更新数据数组。
另外,需要考虑视觉反馈,比如在拖拽时显示占位符或高亮目标位置,提升用户体验。同时,要确保拖拽过程中不影响其他功能,比如行选择、排序等。
还需要注意数据的响应式更新。由于Vue3使用响应式系统,直接修改数据数组的顺序应该能自动更新视图。不过,可能需要使用Vue的响应式方法,比如splice,来确保数组变更被正确追踪。
此外,拖拽功能可能需要禁用某些情况,比如在加载状态时不允许拖拽,或者在固定表头的情况下正确处理滚动位置。
最后,需要更新文档和示例,展示如何使用新的拖拽功能,并处理可能的事件和回调,比如拖拽结束后的数据更新事件。
总结步骤:
添加拖拽事件处理逻辑。
实现行位置的交换和数据的更新。
添加视觉反馈。
确保与其他功能的兼容性。
更新示例和文档。
📘组件代码
以下是添加行拖拽排序功能的完整实现:
<!-- components/Table/Table.vue -->
<template>
<div
class="ds-table"
:class="[`table-size-${size}`, { 'table-stripe': stripe, 'table-border': border }]"
ref="tableContainer"
>
<!-- 原有组件结构保持不变... -->
<!-- 表格容器 -->
<div class="table-container">
<table>
<tbody>
<template v-else>
<tr
v-for="(row, index) in processedData"
:key="rowKey ? row[rowKey] : index"
:class="{
'selected-row': isRowSelected(row),
'stripe-row': stripe && index % 2 === 0,
'dragging': draggingIndex === index
}"
@click="handleRowClick(row)"
draggable="true"
@dragstart="handleDragStart(index, $event)"
@dragover.prevent="handleDragOver(index, $event)"
@dragend="handleDragEnd"
@dragenter="handleDragEnter(index)"
@dragleave="handleDragLeave"
>
<!-- 行内容保持不变... -->
</tr>
<tr
v-if="showDropPlaceholder"
class="drop-placeholder"
:style="{ transform: `translateY(${placeholderPosition}px)` }"
></tr>
</template>
</tbody>
</table>
</div>
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
// 新增props
const props = defineProps({
draggable: {
type: Boolean,
default: false
},
onDragEnd: Function
})
// 拖拽相关状态
const draggingIndex = ref(-1)
const dropIndex = ref(-1)
const showDropPlaceholder = ref(false)
const placeholderPosition = ref(0)
const originalData = ref([])
// 拖拽处理逻辑
const handleDragStart = (index, e) => {
if (!props.draggable || props.loading) return
draggingIndex.value = index
originalData.value = [...props.data]
e.dataTransfer.effectAllowed = 'move'
}
const handleDragOver = (index, e) => {
if (!props.draggable) return
const rect = e.currentTarget.getBoundingClientRect()
const offsetY = e.clientY - rect.top
placeholderPosition.value = rect.top + (offsetY > rect.height / 2 ? rect.height : 0)
dropIndex.value = index
showDropPlaceholder.value = true
}
const handleDragEnter = (index) => {
if (!props.draggable) return
dropIndex.value = index
}
const handleDragLeave = () => {
showDropPlaceholder.value = false
}
const handleDragEnd = () => {
showDropPlaceholder.value = false
if (draggingIndex.value === dropIndex.value) return
const newData = [...originalData.value]
const [movedItem] = newData.splice(draggingIndex.value, 1)
newData.splice(dropIndex.value, 0, movedItem)
emit('update:data', newData)
props.onDragEnd?.({
oldIndex: draggingIndex.value,
newIndex: dropIndex.value,
data: newData
})
draggingIndex.value = -1
dropIndex.value = -1
}
// 其他原有逻辑保持不变...
</script>
<style scoped>
/* 拖拽样式 */
tr[draggable="true"] {
cursor: move;
transition: transform 0.2s;
}
tr.dragging {
opacity: 0.5;
background: #f5f7fa;
}
.drop-placeholder {
height: 2px;
background: #409eff;
position: absolute;
width: 100%;
transition: transform 0.2s;
pointer-events: none;
}
tr:hover:not(.dragging) {
background: #f0f2f5;
}
</style>
使用示例:
<!-- TableView16.vue -->
<template>
<Table
:data="draggableData"
:columns="columns"
draggable
@update:data="handleDataUpdate"
@drag-end="handleDragEnd"
/>
</template>
<script setup>
import { ref } from 'vue'
import Table from '@/components/Table/Table.vue'
const draggableData = ref([
{ id: 1, task: '设计评审', priority: '高' },
{ id: 2, task: '代码开发', priority: '中' },
{ id: 3, task: '测试用例', priority: '低' }
])
const columns = [
{ title: '任务', dataIndex: 'task' },
{ title: '优先级', dataIndex: 'priority' }
]
const handleDataUpdate = (newData) => {
draggableData.value = newData
}
const handleDragEnd = ({ oldIndex, newIndex }) => {
console.log(`从位置 ${oldIndex} 移动到 ${newIndex}`)
}
</script>
功能说明:
拖拽交互:
- 通过HTML5原生拖放API实现
- 显示拖拽过程中的占位符指示线
- 拖拽行半透明效果
数据更新:
- 自动更新数据顺序并触发
update:data
事件 - 提供
drag-end
事件回调 - 保持响应式数据同步
- 自动更新数据顺序并触发
视觉反馈:
- 拖拽时显示蓝色指示线
- 拖拽行半透明效果
- 悬停行高亮提示
兼容性处理:
- 在加载状态时禁用拖拽
- 与分页功能兼容
- 支持固定表头场景
实现细节:
事件处理:
dragstart
:记录初始位置dragover
:计算插入位置dragend
:执行数据更新
数据同步:
- 使用
update:data
实现双向绑定 - 保持原始数据不可变性
- 使用
样式优化:
- 平滑的过渡动画
- 明确的视觉反馈
- 不影响现有样式结构
该实现保持与现有功能(加载状态、列宽调整、导出等)的完全兼容,同时提供直观的行排序交互体验。开发者可以通过简单的属性开关启用功能,并通过事件回调获取排序后的数据。
📚代码测试
运行正常
📚测试代码正常跑通,附其他基本代码
- 添加路由
- 页面展示入口
📘编写路由 src\router\index.js
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: () => import('../views/RatingView.vue')
},
{
path: '/datePicker',
name: 'datePicker',
component: () => import('../views/DatePickerView.vue')
},
{
path: '/colorPicker',
name: 'colorPicker',
component: () => import('../views/ColorPickerView.vue')
},
{
path: '/rightClickMenu',
name: 'rightClickMenu',
component: RightClickMenuView
},
{
path: '/rangePicker',
name: 'rangePicker',
component: () => import('../views/RangePickerView.vue')
},
{
path: '/navbar',
name: 'navbar',
component: () => import('../views/NavbarView.vue')
},
{
path: '/formValidation',
name: 'formValidation',
component: () => import('../views/FormValidationView.vue')
},
{
path: '/copyToClipboard',
name: 'copyToClipboard',
component: () => import('../views/CopyToClipboardView.vue')
},
{
path: '/clickAnimations',
name: 'clickAnimations',
component: () => import('../views/ClickAnimationsView.vue')
},
{
path: '/thumbnailList',
name: 'thumbnailList',
component: () => import('../views/ThumbnailListView.vue')
},
{
path: '/keyboardShortcuts',
name: 'keyboardShortcuts',
component: () => import('../views/KeyboardShortcutsView.vue')
},
{
path: '/commentSystem',
name: 'commentSystem',
component: () => import('../views/CommentSystemView.vue')
},
{
path: '/qRCode',
name: 'qRCode',
component: () => import('../views/QRCodeView.vue')
},
{
path: '/radioButton',
name: 'radioButton',
component: () => import('../views/RadioButtonView.vue')
},
{
path: '/slider',
name: 'slider',
component: () => import('../views/SliderView.vue')
},
{
path: '/scrollAnimations',
name: 'scrollAnimations',
component: () => import('../views/ScrollAnimationsView.vue')
},
{
path: '/textInputView',
name: 'textInputView',
component: () => import('../views/TextInputView.vue')
},
{
path: '/divider',
name: 'divider',
component: () => import('../views/DividerView.vue')
},
{
path: '/checkbox',
name: 'checkbox',
component: () => import('../views/CheckboxView.vue')
},
{
path: '/tagInput',
name: 'tagInput',
component: () => import('../views/TagInputView.vue')
},
{
path: '/dropdownSelect',
name: 'dropdownSelect',
component: () => import('../views/DropdownSelectView.vue')
},
{
path: '/list',
name: 'list',
component: () => import('../views/ListView.vue')
},
{
path: '/header',
name: 'header',
component: () => import('../views/HeaderView.vue')
},
{
path: '/footer',
name: 'footer',
component: () => import('../views/FooterView.vue')
},
{
path: '/pagination',
name: 'pagination',
component: () => import('../views/PaginationView.vue')
},
{
path: '/floatingActionButton',
name: 'floatingActionButton',
component: () => import('../views/FloatingActionButtonView.vue')
},
{
path: '/gridLayout',
name: 'gridLayout',
component: () => import('../views/GridLayoutView.vue')
},
{
path: '/passwordInput',
name: 'passwordInput',
component: () => import('../views/PasswordInputView.vue')
},
{
path: '/flexbox',
name: 'flexbox',
component: () => import('../views/FlexboxView.vue')
},
{
path: '/modal',
name: 'modal',
component: () => import('../views/ModalView.vue')
},
{
path: '/richTextEditor',
name: 'richTextEditor',
component: () => import('../views/RichTextEditorView.vue')
},
{
path: '/timePickerView',
name: 'timePickerView',
component: () => import('../views/TimePickerView.vue')
},
{
path: '/multistepForm',
name: 'multistepForm',
component: () => import('../views/MultistepFormView.vue')
},
{
path: '/table1',
name: 'table1',
component: () => import('../views/TableView1.vue')
},
{
path: '/table2',
name: 'table2',
component: () => import('../views/TableView2.vue')
},
{
path: '/table3',
name: 'table3',
component: () => import('../views/TableView3.vue')
},
{
path: '/table4',
name: 'table4',
component: () => import('../views/TableView4.vue')
},
{
path: '/table5',
name: 'table5',
component: () => import('../views/TableView5.vue')
},
{
path: '/table6',
name: 'table6',
component: () => import('../views/TableView6.vue')
},
{
path: '/table7',
name: 'table7',
component: () => import('../views/TableView7.vue')
},
{
path: '/table8',
name: 'table8',
component: () => import('../views/TableView8.vue')
},
{
path: '/table9',
name: 'table9',
component: () => import('../views/TableView9.vue')
},
{
path: '/table10',
name: 'table10',
component: () => import('../views/TableView10.vue')
},
{
path: '/table11',
name: 'table11',
component: () => import('../views/TableView11.vue')
},
{
path: '/table12',
name: 'table12',
component: () => import('../views/TableView12.vue')
},
{
path: '/table12_02',
name: 'table12_02',
component: () => import('../views/TableView12_02.vue')
},
{
path: '/table14',
name: 'table14',
component: () => import('../views/TableView14.vue')
},
{
path: '/table14_01',
name: 'table14_01',
component: () => import('../views/TableView14_01.vue')
},
{
path: '/table14_02',
name: 'table14_02',
component: () => import('../views/TableView14_02.vue')
},
{
path: '/table14_03',
name: 'table14_03',
component: () => import('../views/TableView14_03.vue')
},
{
path: '/table14_04',
name: 'table14_04',
component: () => import('../views/TableView14_04.vue')
},
{
path: '/table14_05',
name: 'table14_05',
component: () => import('../views/TableView14_05.vue')
},
{
path: '/table14_06',
name: 'table14_06',
component: () => import('../views/TableView14_06.vue')
},
{
path: '/table14_07',
name: 'table14_07',
component: () => import('../views/TableView14_07.vue')
},
{
path: '/table14_08',
name: 'table14_08',
component: () => import('../views/TableView14_08.vue')
},
{
path: '/table14_09',
name: 'table14_09',
component: () => import('../views/TableView14_09.vue')
},
{
path: '/table14_10',
name: 'table14_10',
component: () => import('../views/TableView14_10.vue')
},
{
path: '/table14_11',
name: 'table14_11',
component: () => import('../views/TableView14_11.vue')
},
{
path: '/table14_12',
name: 'table14_12',
component: () => import('../views/TableView14_12.vue')
},
{
path: '/table14_13',
name: 'table14_13',
component: () => import('../views/TableView14_13.vue')
},
{
path: '/table14_14',
name: 'table14_14',
component: () => import('../views/TableView14_14.vue')
},
{
path: '/table15',
name: 'table15',
component: () => import('../views/TableView15.vue')
},
{
path: '/table15_01',
name: 'table15_01',
component: () => import('../views/TableView15_01.vue')
},
{
path: '/table15_02',
name: 'table15_02',
component: () => import('../views/TableView15_02.vue')
},
{
path: '/table15_03',
name: 'table15_03',
component: () => import('../views/TableView15_03.vue')
},
{
path: '/table15_04',
name: 'table15_04',
component: () => import('../views/TableView15_04.vue')
},
{
path: '/table15_05',
name: 'table15_05',
component: () => import('../views/TableView15_05.vue')
},
{
path: '/table15_06',
name: 'table15_06',
component: () => import('../views/TableView15_06.vue')
},
{
path: '/table15_07',
name: 'table15_07',
component: () => import('../views/TableView15_07.vue')
},
{
path: '/table15_08',
name: 'table15_08',
component: () => import('../views/TableView15_08.vue')
},
{
path: '/table15_09',
name: 'table15_09',
component: () => import('../views/TableView15_09.vue')
},
{
path: '/table15_10',
name: 'table15_10',
component: () => import('../views/TableView15_10.vue')
},
{
path: '/table15_11',
name: 'table15_11',
component: () => import('../views/TableView15_11.vue')
},
{
path: '/table15_12',
name: 'table15_12',
component: () => import('../views/TableView15_12.vue')
},
{
path: '/table15_13',
name: 'table15_13',
component: () => import('../views/TableView15_13.vue')
},
{
path: '/table15_14',
name: 'table15_14',
component: () => import('../views/TableView15_14.vue')
},
{
path: '/table16',
name: 'table16',
component: () => import('../views/TableView16.vue')
}
],
})
export default router
📘编写展示入口 src\App.vue
<script setup>
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<nav>
<RouterLink to="/">Progress</RouterLink>
<RouterLink to="/tabs">Tabs</RouterLink>
<RouterLink to="/accordion">Accordion</RouterLink>
<RouterLink to="/timeline">Timeline</RouterLink>
<RouterLink to="/backToTop">BackToTop</RouterLink>
<RouterLink to="/notification">Notification</RouterLink>
<RouterLink to="/card">Card</RouterLink>
<RouterLink to="/infiniteScroll">InfiniteScroll</RouterLink>
<RouterLink to="/switch">Switch</RouterLink>
<RouterLink to="/sidebar">Sidebar</RouterLink>
<RouterLink to="/breadcrumbs">Breadcrumbs</RouterLink>
<RouterLink to="/masonryLayout">MasonryLayout</RouterLink>
<RouterLink to="/rating">Rating</RouterLink>
<RouterLink to="/datePicker">DatePicker</RouterLink>
<RouterLink to="/colorPicker">ColorPicker</RouterLink>
<RouterLink to="/rightClickMenu">RightClickMenu</RouterLink>
<RouterLink to="/rangePicker">RangePicker</RouterLink>
<RouterLink to="/navbar">Navbar</RouterLink>
<RouterLink to="/formValidation">FormValidation</RouterLink>
<RouterLink to="/copyToClipboard">CopyToClipboard</RouterLink>
<RouterLink to="/clickAnimations">ClickAnimations</RouterLink>
<RouterLink to="/thumbnailList">ThumbnailList</RouterLink>
<RouterLink to="/keyboardShortcuts">KeyboardShortcuts</RouterLink>
<RouterLink to="/commentSystem">CommentSystem</RouterLink>
<RouterLink to="/qRCode">QRCode</RouterLink>
<RouterLink to="/radioButton">RadioButton</RouterLink>
<RouterLink to="/slider">Slider</RouterLink>
<RouterLink to="/scrollAnimations">ScrollAnimations</RouterLink>
<RouterLink to="/textInputView">TextInput</RouterLink>
<RouterLink to="/divider">Divider</RouterLink>
<RouterLink to="/checkbox">Checkbox</RouterLink>
<RouterLink to="/tagInput">TagInput</RouterLink>
<RouterLink to="/dropdownSelect">DropdownSelect</RouterLink>
<RouterLink to="/list">List</RouterLink>
<RouterLink to="/header">Header</RouterLink>
<RouterLink to="/footer">Footer</RouterLink>
<RouterLink to="/pagination">Pagination</RouterLink>
<RouterLink to="/floatingActionButton">FloatingActionButton</RouterLink>
<RouterLink to="/gridLayout">GridLayout</RouterLink>
<RouterLink to="/passwordInput">PasswordInput</RouterLink>
<RouterLink to="/flexbox">Flexbox</RouterLink>
<RouterLink to="/modal">Modal</RouterLink>
<RouterLink to="/richTextEditor">RichTextEditor</RouterLink>
<RouterLink to="/timePickerView">TimePickerView</RouterLink>
<RouterLink to="/multistepForm">MultistepFormView</RouterLink>
<RouterLink to="/table1">Table1</RouterLink>
<RouterLink to="/table2">Table2</RouterLink>
<RouterLink to="/table3">Table3</RouterLink>
<RouterLink to="/table4">Table4</RouterLink>
<RouterLink to="/table5">Table5</RouterLink>
<RouterLink to="/table6">Table6空状态</RouterLink>
<RouterLink to="/table7">Table7空状态2</RouterLink>
<RouterLink to="/table8">Table8基础加载状态</RouterLink>
<RouterLink to="/table9">Table9自定义加载文本</RouterLink>
<RouterLink to="/table10">Table10完全自定义加载内容</RouterLink>
<RouterLink to="/table11">Table11加载结合分页</RouterLink>
<RouterLink to="/table12">Table12启用列宽调整</RouterLink>
<RouterLink to="/table12_02">table12_02自定义选择列宽度</RouterLink>
<RouterLink to="/table14">table14 添加表头固定功能</RouterLink>
<RouterLink to="/table14_01">table14_01</RouterLink>
<RouterLink to="/table14_02">table14_02</RouterLink>
<RouterLink to="/table14_03">table14_03</RouterLink>
<RouterLink to="/table14_04">table14_04</RouterLink>
<RouterLink to="/table14_05">table14_05</RouterLink>
<RouterLink to="/table14_06">table14_06</RouterLink>
<RouterLink to="/table14_07">table14_07</RouterLink>
<RouterLink to="/table14_08">table14_08</RouterLink>
<RouterLink to="/table14_09">table14_09</RouterLink>
<RouterLink to="/table14_10">table14_10</RouterLink>
<RouterLink to="/table14_11">table14_11</RouterLink>
<RouterLink to="/table14_12">table14_12</RouterLink>
<RouterLink to="/table14_13">table14_13</RouterLink>
<RouterLink to="/table14_14">table14_14</RouterLink>
<RouterLink to="/table15">table15 导出数据功能</RouterLink>
<RouterLink to="/table15_01">table15_01</RouterLink>
<RouterLink to="/table15_02">table15_02</RouterLink>
<RouterLink to="/table15_03">table15_03</RouterLink>
<RouterLink to="/table15_04">table15_04</RouterLink>
<RouterLink to="/table15_05">table15_05</RouterLink>
<RouterLink to="/table15_06">table15_06</RouterLink>
<RouterLink to="/table15_07">table15_07</RouterLink>
<RouterLink to="/table15_08">table15_08</RouterLink>
<RouterLink to="/table15_09">table15_09</RouterLink>
<RouterLink to="/table15_10">table15_10</RouterLink>
<RouterLink to="/table15_11">table15_11</RouterLink>
<RouterLink to="/table15_12">table15_12</RouterLink>
<RouterLink to="/table15_13">table15_13</RouterLink>
<RouterLink to="/table15_14">table15_14</RouterLink>
<RouterLink to="/table16">table16添加行拖拽排序功能</RouterLink>
</nav>
</div>
</header>
<RouterView />
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
📚页面效果
📚相关文章
DeepSeek 助力 Vue 开发:打造丝滑的步骤条(Step bar)https://blog.csdn.net/qq_33650655/article/details/145560497
DeepSeek 助力 Vue 开发:打造丝滑的进度条(Progress Bar)https://blog.csdn.net/qq_33650655/article/details/145577034
DeepSeek 助力 Vue 开发:打造丝滑的标签页(Tabs)https://blog.csdn.net/qq_33650655/article/details/145587999
DeepSeek 助力 Vue 开发:打造丝滑的折叠面板(Accordion)https://blog.csdn.net/qq_33650655/article/details/145590404
DeepSeek 助力 Vue 开发:打造丝滑的时间线(Timeline )https://blog.csdn.net/qq_33650655/article/details/145597372
DeepSeek 助力 Vue 开发:打造丝滑的卡片(Card)https://blog.csdn.net/qq_33650655/article/details/145634564
DeepSeek 助力 Vue 开发:打造丝滑的开关切换(Switch)https://blog.csdn.net/qq_33650655/article/details/145644151
DeepSeek 助力 Vue 开发:打造丝滑的侧边栏(Sidebar)https://blog.csdn.net/qq_33650655/article/details/145654204
DeepSeek 助力 Vue 开发:打造丝滑的评分组件(Rating)https://blog.csdn.net/qq_33650655/article/details/145664576
DeepSeek 助力 Vue 开发:打造丝滑的导航栏(Navbar)https://blog.csdn.net/qq_33650655/article/details/145732421
DeepSeek 助力 Vue 开发:打造丝滑的二维码生成(QR Code)https://blog.csdn.net/qq_33650655/article/details/145797928
DeepSeek 助力 Vue 开发:打造丝滑的滑块(Slider)https://blog.csdn.net/qq_33650655/article/details/145817161
DeepSeek 助力 Vue 开发:打造丝滑的文本输入框(Text Input)https://blog.csdn.net/qq_33650655/article/details/145837003
DeepSeek 助力 Vue 开发:打造丝滑的分割线(Divider)https://blog.csdn.net/qq_33650655/article/details/145849100
DeepSeek 助力 Vue 开发:打造丝滑的 复选框(Checkbox)https://blog.csdn.net/qq_33650655/article/details/145855695
DeepSeek 助力 Vue3 开发:打造丝滑的标签输入(Tag Input)https://blog.csdn.net/qq_33650655/article/details/145858574
DeepSeek 助力 Vue3 开发:打造丝滑的列表(List)https://blog.csdn.net/qq_33650655/article/details/145866384
DeepSeek 助力 Vue3 开发:打造丝滑的页眉(Header)https://blog.csdn.net/qq_33650655/article/details/145885122
DeepSeek 助力 Vue3 开发:打造丝滑的页脚(Footer)https://blog.csdn.net/qq_33650655/article/details/145886306
DeepSeek 助力 Vue3 开发:打造丝滑的分页(Pagination)https://blog.csdn.net/qq_33650655/article/details/145886824
DeepSeek 助力 Vue3 开发:打造丝滑的弹性布局(Flexbox)https://blog.csdn.net/qq_33650655/article/details/145938677
DeepSeek 助力 Vue3 开发:打造丝滑的模态框(Modal)https://blog.csdn.net/qq_33650655/article/details/145938939
到此这篇文章就介绍到这了,更多精彩内容请关注本人以前的文章或继续浏览下面的文章,创作不易,如果能帮助到大家,希望大家多多支持宝码香车~💕,若转载本文,一定注明本文链接。
更多专栏订阅推荐:
👍 html+css+js 绚丽效果
💕 vue
✈️ Electron
⭐️ js
📝 字符串
✍️ 时间对象(Date())操作