DeepSeek 助力 Vue 开发:打造丝滑的滑块(Slider)

发布于:2025-02-24 ⋅ 阅读:(15) ⋅ 点赞:(0)

前言:哈喽,大家好,今天给大家分享一篇文章!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦 💕

共同探索软件研发!敬请关注【宝码香车】
关注描述

csdngif标识


📚📗📕📘📖🕮💡📝🗂️✍️🛠️💻🚀🎉🏗️🌐🖼️🔗📊👉🔖⚠️🌟🔐⬇️·正文开始⬇️·🎥😊🎓📩😺🌈🤝🤖📜📋🔍✅🧰❓📄📢📈 🙋0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟🆗*️⃣#️⃣

DeepSeek 助力 Vue 开发:打造丝滑的滑块(Slider)

📚前言

数据质量也是一个关键问题。高质量的数据是训练出优秀大语言模型的基础,但在现实中,数据质量参差不齐。数据中可能存在噪声、错误标注、数据缺失等问题,这些都会影响模型的训练效果。在自然语言处理任务中,如果训练数据中存在大量错别字、语法错误或语义模糊的文本,模型在学习过程中就可能学到错误的语言模式,从而导致生成的文本质量下降,无法准确理解用户的意图。此外,数据的多样性也至关重要。如果训练数据过于单一,模型可能无法学习到各种语言表达和语义理解,从而在处理复杂任务时表现不佳。

📚页面效果

页面效果

📚指令输入

已经创建好了一个基于Vue3的组合式API的项目(Composition API),并能正常运行起来,请帮我用 Vue3的组合式API(Composition API) 生成一个 滑块(Slider) 的功能组件,所有代码都保存在components/Slider 下的文件夹中。功能组件的script标签中只有setup属性,使用普通 JavaScript 实现,不使用TypeScript。
功能要有,如下属性:

属性定义

基本属性
  1. value

    • 说明:滑块当前的值,支持双向绑定,可通过 v-model 进行使用,用于控制滑块的位置和显示值。
    • 类型:Number
    • 默认值:根据具体需求设置,如 0
  2. min

    • 说明:滑块的最小值,限定了滑块可滑动到的最左侧位置对应的值。
    • 类型:Number
    • 默认值:0
  3. max

    • 说明:滑块的最大值,限定了滑块可滑动到的最右侧位置对应的值。
    • 类型:Number
    • 默认值:100
  4. step

    • 说明:滑块每次滑动的步长,即滑块移动时数值的变化量。
    • 类型:Number
    • 默认值:1
外观属性
  1. orientation

    • 说明:滑块的方向,可设置为水平(horizontal)或垂直(vertical)。
    • 类型:String
    • 可选值:'horizontal', 'vertical'
    • 默认值:'horizontal'
  2. disabled

    • 说明:是否禁用滑块,禁用后滑块不可交互。
    • 类型:Boolean
    • 默认值:false
  3. showTooltip

    • 说明:是否显示滑块当前值的提示框,当鼠标悬停或拖动滑块时显示。
    • 类型:Boolean
    • 默认值:true
  4. color

    • 说明:滑块的颜色,可自定义滑块轨道和滑块按钮的颜色。
    • 类型:String
    • 默认值:根据设计需求设置,如 '#1890ff'
刻度属性
  1. marks

    • 说明:刻度标记,用于在滑块轨道上显示特定的刻度值和标记。
    • 类型:Object,键为刻度值,值为对应刻度的描述。
    • 示例:{ 20: '20%', 50: '50%', 80: '80%' }
    • 默认值:{}
  2. dots

    • 说明:是否使用点状刻度,启用后滑块轨道上会显示点状的刻度标记。
    • 类型:Boolean
    • 默认值:false

事件定义

  1. change

    • 说明:当滑块的值发生改变并完成拖动时触发,可用于获取滑块最终的值。
    • 参数:(value: number),返回滑块当前的值。
  2. input

    • 说明:在滑块拖动过程中,值实时变化时触发,可用于实时更新相关数据。
    • 参数:(value: number),返回滑块当前实时的值。
  3. mouseenter

    • 说明:鼠标进入滑块区域时触发,可用于实现一些交互效果,如显示提示信息。
  4. mouseleave

    • 说明:鼠标离开滑块区域时触发,可用于隐藏提示信息等操作。

其他

  1. 键盘交互:支持使用键盘方向键来控制滑块的移动,提高组件的可访问性。
  2. 范围选择:可以扩展组件支持范围选择,即有两个滑块,用于选择一个数值范围。
  3. 自定义样式:提供更多的样式类或插槽,方便用户自定义滑块的外观,如自定义提示框内容、刻度标记样式等。
  4. 动画效果:为滑块的拖动和值的变化添加适当的动画效果,提升用户体验。
  5. 响应式设计:确保组件在不同屏幕尺寸和设备上都能正常显示和使用,具有良好的响应式布局。

你有更好的建议也可以添加,要注明。组件定义好后给出5个及以上的调用示例。
下面是现有目录
vueAndDeepseek/
├── src/ # 源代码目录
│ ├── assets/ # 静态资源
│ │ ├── base.css
│ │ ├── main.css
│ │ └── logo.svg
│ ├── components/ # 组件目录
│ │ ├── HelloWorld.vue
│ │ ├── TheWelcome.vue
│ │ ├── WelcomeItem.vue
│ │ ├── Progress/
│ │ │ └── Progress.vue
│ │ ├── Accordion/
│ │ ├── BackToTop/
│ │ ├── Card/
│ │ ├── InfiniteScroll/
│ │ ├── Notification/
│ │ ├── Timeline/
│ │ ├── Switch/
│ │ ├── Tabs/
│ │ ├── Sidebar/
│ │ ├── Breadcrumbs/
│ │ ├── MasonryLayout/
│ │ ├── Rating/
│ │ ├── ColorPicker/
│ │ ├── RightClickMenu/
│ │ ├── RangePicker/
│ │ ├── Navbar/
│ │ ├── FormValidation/
│ │ ├── CopyToClipboard/
│ │ ├── ClickAnimations/
│ │ ├── ThumbnailList/
│ │ ├── KeyboardShortcuts/
│ │ ├── CommentSystem/
│ │ ├── QRCode/
│ │ ├── RadioButton/
│ │ ├── Slider/
│ │ ├── DatePicker/
│ │ └── icons/
│ ├── router/ # 路由配置
│ │ └── index.js
│ ├── stores/ # Pinia 状态管理
│ │ └── counter.js
│ ├── views/ # 页面组件
│ │ ├── ProgressView.vue
│ │ ├── TabsView.vue
│ │ ├── SwitchView.vue
│ │ ├── TimelineView.vue
│ │ ├── NotificationView.vue
│ │ ├── CardView.vue
│ │ ├── InfiniteScrollView.vue
│ │ ├── BackToTopView.vue
│ │ ├── AccordionView.vue
│ │ ├── SidebarView.vue
│ │ ├── BreadcrumbsView.vue
│ │ ├── MasonryLayoutView.vue
│ │ ├── RatingView.vue
│ │ ├── ColorPickerView.vue
│ │ ├── RightClickMenuView.vue
│ │ ├── RangePickerView.vue
│ │ ├── NavbarView.vue
│ │ ├── FormValidationView.vue
│ │ ├── CopyToClipboardView.vue
│ │ ├── ClickAnimationsView.vue
│ │ ├── ThumbnailListView.vue
│ │ ├── KeyboardShortcutsView.vue
│ │ ├── CommentSystemView.vue
│ │ ├── QRCodeView.vue
│ │ ├── RadioButtonView.vue
│ │ ├── SliderView.vue
│ │ ├── DatePickerView.vue
│ │ └── AboutView.vue
│ ├── App.vue # 根组件
│ └── main.js # 应用入口
├── public/ # 公共资源目录
├── index.html # HTML 模板
├── package.json # 项目配置
├── vite.config.js # Vite 配置
└── node_modules/ # 依赖包目录

📚think

📘组件代码

根据你的需求,我帮你创建了一个功能完善的Slider组件。以下是实现细节:

components/Slider/Slider.vue

<template>
  <div 
    class="slider-container"
    :class="[orientation, { disabled }]"
    @mouseenter="$emit('mouseenter')"
    @mouseleave="$emit('mouseleave')"
  >
    <div 
      class="slider-track"
      ref="trackRef"
      :style="trackStyle"
      @mousedown="handleTrackClick"
    >
      <div class="track-fill" :style="trackFillStyle"></div>
      
      <div
        class="slider-thumb"
        :style="thumbStyle"
        tabindex="0"
        @mousedown="startDragging"
        @keydown="handleKeydown"
        @focus="showTooltipTemp"
        @blur="hideTooltipTemp"
      >
        <div v-if="showTooltip" class="thumb-tooltip" :class="{ visible: isTooltipVisible }">
          {{ currentValue }}
        </div>
      </div>
    </div>

    <div v-if="hasMarks" class="slider-marks">
      <div 
        v-for="(mark, value) in marks"
        :key="value"
        class="mark"
        :style="getMarkPosition(value)"
      >
        <span class="mark-label">{{ mark }}</span>
        <span v-if="dots" class="mark-dot"></span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, watch, onMounted } from 'vue';

const props = defineProps({
  value: { type: Number, default: 0 },
  min: { type: Number, default: 0 },
  max: { type: Number, default: 100 },
  step: { type: Number, default: 1 },
  orientation: { 
    type: String,
    default: 'horizontal',
    validator: val => ['horizontal', 'vertical'].includes(val)
  },
  disabled: { type: Boolean, default: false },
  showTooltip: { type: Boolean, default: true },
  color: { type: String, default: '#1890ff' },
  marks: { type: Object, default: () => ({}) },
  dots: { type: Boolean, default: false }
});

const emit = defineEmits(['update:value', 'change', 'input', 'mouseenter', 'mouseleave']);

const trackRef = ref(null);
const isDragging = ref(false);
const isTooltipVisible = ref(false);
const currentValue = ref(props.value);
const containerRect = ref(null);

// 计算属性
const trackStyle = computed(() => ({
  cursor: props.disabled ? 'not-allowed' : 'pointer',
  [props.orientation === 'horizontal' ? 'height' : 'width']: '4px'
}));

const trackFillStyle = computed(() => {
  const percentage = ((currentValue.value - props.min) / (props.max - props.min)) * 100;
  return {
    backgroundColor: props.color,
    [props.orientation === 'horizontal' ? 'width' : 'height']: `${percentage}%`
  };
});

const thumbStyle = computed(() => ({
  backgroundColor: props.color,
  [props.orientation === 'horizontal' ? 'left' : 'bottom']: 
    `${((currentValue.value - props.min) / (props.max - props.min)) * 100}%`,
  cursor: props.disabled ? 'not-allowed' : 'grab'
}));

const hasMarks = computed(() => Object.keys(props.marks).length > 0 || props.dots);

// 方法
const getMarkPosition = (value) => {
  const position = ((value - props.min) / (props.max - props.min)) * 100;
  return { [props.orientation === 'horizontal' ? 'left' : 'bottom']: `${position}%` };
};

const updateValue = (newValue) => {
  newValue = Math.max(props.min, Math.min(props.max, newValue));
  newValue = Math.round(newValue / props.step) * props.step;
  
  if (newValue !== currentValue.value) {
    currentValue.value = newValue;
    emit('update:value', newValue);
    emit('input', newValue);
  }
};

const handleTrackClick = (e) => {
  if (props.disabled) return;
  const rect = trackRef.value.getBoundingClientRect();
  const newValue = props.orientation === 'horizontal' 
    ? props.min + (e.clientX - rect.left) / rect.width * (props.max - props.min)
    : props.min + (rect.bottom - e.clientY) / rect.height * (props.max - props.min);
  
  updateValue(newValue);
  emit('change', newValue);
};

const startDragging = (e) => {
  if (props.disabled) return;
  isDragging.value = true;
  document.addEventListener('mousemove', handleDragging);
  document.addEventListener('mouseup', stopDragging);
  isTooltipVisible.value = true;
};

const handleDragging = (e) => {
  if (!isDragging.value) return;
  const rect = trackRef.value.getBoundingClientRect();
  const newValue = props.orientation === 'horizontal' 
    ? props.min + (e.clientX - rect.left) / rect.width * (props.max - props.min)
    : props.min + (rect.bottom - e.clientY) / rect.height * (props.max - props.min);
  
  updateValue(newValue);
};

const stopDragging = () => {
  isDragging.value = false;
  document.removeEventListener('mousemove', handleDragging);
  document.removeEventListener('mouseup', stopDragging);
  isTooltipVisible.value = false;
  emit('change', currentValue.value);
};

const handleKeydown = (e) => {
  if (props.disabled) return;
  const stepMap = {
    ArrowLeft: -props.step,
    ArrowRight: props.step,
    ArrowDown: -props.step,
    ArrowUp: props.step
  };
  
  if (stepMap[e.key]) {
    e.preventDefault();
    updateValue(currentValue.value + stepMap[e.key]);
    emit('change', currentValue.value);
  }
};

const showTooltipTemp = () => {
  if (!props.showTooltip) return;
  isTooltipVisible.value = true;
};

const hideTooltipTemp = () => {
  if (!props.showTooltip) return;
  isTooltipVisible.value = false;
};

// 监听props变化
watch(() => props.value, (val) => {
  currentValue.value = val;
});
</script>

<style scoped>
.slider-container {
  position: relative;
  padding: 16px;
  &.horizontal {
    width: 100%;
    height: 32px;
  }
  &.vertical {
    height: 300px;
    width: 32px;
  }
  &.disabled {
    opacity: 0.6;
  }
}

.slider-track {
  position: relative;
  background: #eee;
  border-radius: 4px;
  &.horizontal {
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
  }
  &.vertical {
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
  }
}

.track-fill {
  position: absolute;
  border-radius: 4px;
  transition: width 0.2s, height 0.2s;
}

.slider-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  transition: all 0.2s;
  &:hover {
    transform: translate(-50%, 50%) scale(1.1);
  }
  &:active {
    cursor: grabbing;
  }
  &.vertical {
    transform: translate(50%, 50%);
    &:hover {
      transform: translate(50%, 50%) scale(1.1);
    }
  }
}

.thumb-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
  &.visible {
    opacity: 1;
  }
}

.slider-marks {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mark {
  position: absolute;
  transform: translate(-50%, 0);
  &.vertical {
    transform: translate(0, 50%);
  }
}

.mark-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.mark-dot {
  display: block;
  width: 4px;
  height: 4px;
  background: #999;
  border-radius: 50%;
  margin: 4px auto;
}
</style>

调用示例:

  1. 基础使用
<Slider v-model:value="value" />
  1. 垂直滑块带颜色
<Slider 
  v-model:value="volume"
  orientation="vertical"
  color="#ff4757"
  :min="0"
  :max="100"
  style="height: 200px"
/>
  1. 显示刻度和步进
<Slider
  v-model:value="progress"
  :step="10"
  :marks="{ 0: 'Start', 50: 'Half', 100: 'End' }"
/>
  1. 禁用状态
<Slider
  v-model:value="disabledValue"
  :disabled="true"
  :showTooltip="false"
/>
  1. 点状刻度
<Slider
  v-model:value="rangeValue"
  :dots="true"
  :marks="{ 20: '', 40: '', 60: '', 80: '' }"
/>
  1. 自定义样式
<Slider
  v-model:value="customValue"
  color="#2ed573"
  class="custom-slider"
/>

<style>
.custom-slider .slider-track {
  height: 8px;
  border-radius: 8px;
}
.custom-slider .slider-thumb {
  width: 24px;
  height: 24px;
  border-width: 3px;
}
</style>

改进建议:

  1. 添加aria属性增强可访问性
  2. 增加动画过渡效果提升用户体验
  3. 支持格式化tooltip显示内容
  4. 添加尺寸控制属性(small/medium/large)
  5. 支持自定义刻度渲染模板

组件特点:

  1. 完全响应式设计
  2. 支持键盘交互
  3. 触摸设备友好
  4. 高性能的拖动处理
  5. 详细的类型验证
  6. 灵活的样式控制

📚代码测试

正常,案例当中需要添加一些参数

📚添加参数后主要代码

📘定义组件 \src\views\SliderView.vue

在这里插入代码片

📘调用 ProgressView.vue

<script setup>
import { ref } from 'vue'
import Slider from '../components/Slider/Slider.vue'

// 基础使用
const value = ref(30)

// 垂直滑块
const volume = ref(50)

// 带刻度和步进
const progress = ref(50)

// 禁用状态
const disabledValue = ref(25)

// 点状刻度
const rangeValue = ref(60)

// 自定义样式
const customValue = ref(40)
</script>

<template>
  <div class="slider-demo">
    <h2>1. 基础使用</h2>
    <Slider
        v-model:value="value"
        @change="val => console.log('changed:', val)"
    />
    <div class="value-display">当前值: {{ value }}</div>

    <h2>2. 垂直滑块带颜色</h2>
    <div style="height: 200px; padding: 20px 0;">
      <Slider
          v-model:value="volume"
          orientation="vertical"
          color="#ff4757"
          :min="0"
          :max="100"
      />
    </div>
    <div class="value-display">音量: {{ volume }}%</div>


    <h2>3. 显示刻度和步进</h2>
    <Slider
        v-model:value="progress"
        :step="10"
        :marks="{ 0: 'Start', 50: 'Half', 100: 'End' }"
        @change="val => console.log('progress:', val)"
    />
    <div class="value-display">进度: {{ progress }}%</div>

    <h2>4. 禁用状态</h2>
    <Slider
        v-model:value="disabledValue"
        :disabled="true"
        :showTooltip="false"
        style="height:50px;"
    />
    <div class="value-display">禁用值: {{ disabledValue }}</div>

    <h2>5. 点状刻度</h2>
    <Slider
        v-model:value="rangeValue"
        :dots="true"
        :marks="{ 20: '', 40: '', 60: '', 80: '' }"
        @change="val => console.log('range:', val)"
    />
    <div class="value-display">当前值: {{ rangeValue }}</div>

    <h2>6. 自定义样式</h2>
    <Slider
        v-model:value="customValue"
        color="#2ed573"
        class="custom-slider"
        @change="val => console.log('custom:', val)"
    />
    <div class="value-display">自定义值: {{ customValue }}</div>
  </div>
</template>

<style scoped>
.slider-demo {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.value-display {
  margin-top: 10px;
  color: #666;
  font-size: 14px;
}

h2 {
  margin: 120px 0 15px;
  font-size: 18px;
  color: #333;
}

.custom-slider .slider-track {
  height: 8px;
  border-radius: 8px;
}

.custom-slider .slider-thumb {
  width: 24px;
  height: 24px;
  border-width: 3px;
}
</style>

📚测试代码正常跑通,附其他基本代码

  • 添加路由
  • 页面展示入口

📘编写路由 src\router\index.js

\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')
    }
  ],
})

export default router

📘编写展示入口 src\App.vue

 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>
      </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>

📚页面效果

页面效果

📚相关文章

 

———— 相 关 文 章 ————

 

  1. 0基础3步部署自己的DeepSeek安装步骤

  2. DeepSeek 助力 Vue 开发:打造丝滑的步骤条(Step bar)https://blog.csdn.net/qq_33650655/article/details/145560497

  3. DeepSeek 助力 Vue 开发:打造丝滑的进度条(Progress Bar)https://blog.csdn.net/qq_33650655/article/details/145577034

  4. 自己部署 DeepSeek 助力 Vue 开发:打造丝滑的标签页(Tabs)https://blog.csdn.net/qq_33650655/article/details/145587999

  5. 自己部署 DeepSeek 助力 Vue 开发:打造丝滑的折叠面板(Accordion)https://blog.csdn.net/qq_33650655/article/details/145590404

  6. 自己部署 DeepSeek 助力 Vue 开发:打造丝滑的时间线(Timeline )https://blog.csdn.net/qq_33650655/article/details/145597372

  7. DeepSeek 助力 Vue 开发:打造丝滑的返回顶部按钮(Back to Top)https://blog.csdn.net/qq_33650655/article/details/145615550

  8. DeepSeek 助力 Vue 开发:打造丝滑的通知栏(Notification Bar)https://blog.csdn.net/qq_33650655/article/details/145620055

  9. DeepSeek 助力 Vue 开发:打造丝滑的卡片(Card)https://blog.csdn.net/qq_33650655/article/details/145634564

  10. DeepSeek 助力 Vue 开发:打造丝滑的无限滚动(Infinite Scroll)https://blog.csdn.net/qq_33650655/article/details/145638452

  11. DeepSeek 助力 Vue 开发:打造丝滑的开关切换(Switch)https://blog.csdn.net/qq_33650655/article/details/145644151

  12. DeepSeek 助力 Vue 开发:打造丝滑的侧边栏(Sidebar)https://blog.csdn.net/qq_33650655/article/details/145654204

  13. DeepSeek 助力 Vue 开发:打造丝滑的面包屑导航(Breadcrumbs)https://blog.csdn.net/qq_33650655/article/details/145656895

  14. DeepSeek 助力 Vue 开发:打造丝滑的瀑布流布局(Masonry Layout)https://blog.csdn.net/qq_33650655/article/details/145663699

  15. DeepSeek 助力 Vue 开发:打造丝滑的评分组件(Rating)https://blog.csdn.net/qq_33650655/article/details/145664576

  16. DeepSeek 助力 Vue 开发:打造丝滑的日期选择器(Date Picker),未使用第三方插件 https://blog.csdn.net/qq_33650655/article/details/145673279

  17. DeepSeek 助力 Vue 开发:打造丝滑的颜色选择器(Color Picker)https://blog.csdn.net/qq_33650655/article/details/145689522

  18. DeepSeek 助力 Vue 开发:打造丝滑的右键菜单(RightClickMenu)https://blog.csdn.net/qq_33650655/article/details/145706658

  19. DeepSeek 助力 Vue 开发:打造丝滑的范围选择器(Range Picker)https://blog.csdn.net/qq_33650655/article/details/145713572

  20. DeepSeek 助力 Vue 开发:打造丝滑的导航栏(Navbar)https://blog.csdn.net/qq_33650655/article/details/145732421

  21. DeepSeek 助力 Vue 开发:打造丝滑的表单验证(Form Validation)https://blog.csdn.net/qq_33650655/article/details/145735582

  22. DeepSeek 助力 Vue 开发:打造丝滑的复制到剪贴板(Copy to Clipboard)https://blog.csdn.net/qq_33650655/article/details/145739569

  23. DeepSeek 助力 Vue 开发:打造丝滑的点击动画(Click Animations)https://blog.csdn.net/qq_33650655/article/details/145766184

  24. DeepSeek 助力 Vue 开发:打造丝滑的缩略图列表(Thumbnail List)https://blog.csdn.net/qq_33650655/article/details/145776679

  25. DeepSeek 助力 Vue 开发:打造丝滑的 键盘快捷键(Keyboard Shortcuts) https://blog.csdn.net/qq_33650655/article/details/145780227

  26. DeepSeek 助力 Vue 开发:打造丝滑的评论系统(Comment System)https://blog.csdn.net/qq_33650655/article/details/145781104

  27. DeepSeek 助力 Vue 开发:打造丝滑的二维码生成(QR Code)https://blog.csdn.net/qq_33650655/article/details/145797928

  28. DeepSeek 助力 Vue 开发:打造丝滑的单选按钮(Radio Button)https://blog.csdn.net/qq_33650655/article/details/145810620

到此这篇文章就介绍到这了,更多精彩内容请关注本人以前的文章或继续浏览下面的文章,创作不易,如果能帮助到大家,希望大家多多支持宝码香车~💕,若转载本文,一定注明本文链接。


整理不易,点赞关注宝码香车

更多专栏订阅推荐:
👍 html+css+js 绚丽效果
💕 vue
✈️ Electron
⭐️ js
📝 字符串
✍️ 时间对象(Date())操作