ve-anchor 锚点

目录

ve-anchor 锚点

功能描述

  1. 需要展现当前页面上可供跳转的锚点链接,以及快速在锚点之间跳转。

Api

效果图

在需要使用该组件的 Vue 文件中,引入组件:

javascript 复制代码
<script lang="ts" setup>
const items = ref([
  {
    id: 'part-1',
    title: 'part-1',
  },
  {
    id: 'part-2',
    title: 'part-2',
  },
  {
    id: 'part-3',
    title: 'part-3',
    children: [
      {
        id: 'part-3-1',
        title: 'part-3-1',
      },
      {
        id: 'part-3-2',
        title: 'part-3-2',
      },
    ],
  }
])
</script>
<template>
  <el-row id="parent-scroll" style="height: 300px; overflow: auto">
    <el-col :span="18">
      <div id="part-1" class="group" style="height: 300px; background: #C6E2FF"/>
      <div id="part-2" class="group" style="height: 300px; background: #F8E3C5"/>
      <div id="part-3" class="group" style="height: 300px; background: #FCD3D3"/>
      <div id="part-3-1" class="group" style="height: 300px; background: #C6E2FF"/>
      <div id="part-3-2" class="group" style="height: 300px; background: #F8E3C5"/>
    </el-col>
    <el-col :span="6">
      <ve-anchor :items="items" group="group" parent-scroll="parent-scroll"/>
    </el-col>
  </el-row>
</template>
<style lang="less" scoped>
#parent-scroll {
  scroll-behavior: smooth;
  overflow-y: scroll; /* 确保容器可以滚动 */
}
</style>

属性

属性名 说明 类型 可选值 默认值
items 锚点树结构 array - -
items:id 锚点id,用于寻找对应的dom,该值对应锚点区域绑定的id属性 string - -
items:title 锚点id,用于寻找对应的dom,该值对应锚点区域绑定的id属性 string - -
group 所有锚点区域的class属性,用于获取锚点区域dom集合 string - -
parent-scroll 需要监听滚动的dom的id属性,用于获取滚动区域dom string - -

Assets

插件市场:ve-anchor 锚点
源码:Github
源码:Gitee
组件库演示地址

Warn

  1. 该组件是基于element-plus开发,需要在此基础上使用。

相关推荐
千寻技术帮10 小时前
10422_基于Springboot的教务管理系统
java·spring boot·后端·vue·教务管理
是梦终空13 小时前
计算机毕业设计260—基于Springboot+Vue3+Ai对话的非遗传承管理系统(源代码+数据库+2万字论文)
spring boot·vue·毕业设计·课程设计·毕业论文·ai对话·非遗传承管理系统
PascalMing20 小时前
Pascal.Edge物联网平台:生产企业设备数据采集与管理解决方案
物联网·c#·vue·数据采集
启扶农1 天前
lecen:一个更好的开源可视化系统搭建项目--介绍、搭建、访问与基本配置--全低代码|所见即所得|利用可视化设计器构建你的应用系统-做一个懂你的人
低代码·vue·node·所见即所得·表单设计·页面可视化·页面设计器
爱分享的小诺1 天前
在谷歌浏览器上的谷歌商店进不去,可以使用...
vue·谷歌浏览器·扩展插件
小徐不会敲代码~2 天前
Vue3 学习 5
前端·学习·vue
今天有个Bug2 天前
【计算机毕业设计】流浪动物救助平台 - SpringBoot+Vue
sql·mysql·spring·vue·毕业设计·课程设计
捧 花3 天前
前端如何调用后端接口(HTML + JS & Vue )
服务器·golang·vue·api·前后端交互
扶我起来还能学_3 天前
Vue3 proxy 数据响应式的简单实现
前端·javascript·vue
IT教程资源D3 天前
[N_101]基于springboot,vue企业网盘系统
mysql·vue·前后端分离·springboot网盘