效果图

- 标题table栏可以切换,这里就不上代码了,切换的时候需要重新销毁和重建一下dom节点,否则会出现bug,使用这个插件的时候需要注意一下dom节点的问题
- 首先需要装一下 这个插件
- 可以看一下插件的文档
:https://chenxuan0000.github.io/vue-seamless-scroll/guide/
npm install vue-seamless-scroll --save
- 主要代码:样式根据自己需求调整,请求接口请换成自己的,根据数据处理
<template>
<div>
<div class="item">
<div class="title">
<span>{
{
title }}</span>
<span>{
{
num }}<span style="fontSize:18px">{
{
unit }}</span></span>
</div>
<vue-seamless-scroll :data="list" :class-option="classOption" id="warp" class="warp" v-if="isShow">
<div class="ech_situation"></div>
</vue-seamless-scroll>
</div>
</div>
</template>
<script>
import echarts from 'echarts'
import {
subsidyDetail } from '@/api/cockpit'
import vueSeamlessScroll from 'vue-seamless-scroll'
export default {
components: {
cockpitTitle,
vueSeamlessScroll
},
data() {
return {
num: 0,
isShow: true,
unit: '万人',
list: [],
type: 1,
classOption: {
singleHeight: 50,
waitTime: 0
},
data: [],
title: '',
total: []
}
},
computed: {
},
watch: {
},
methods: {
async change(type) {
this.isShow = false
await this.getData(type)
this.isShow = true
setTimeout(() => {
document.querySelectorAll('.ech_situation').forEach(dom => {
this._subsidyDetail