无缝滚动插件(vue-seamless-scroll)

  • vue-seamless-scroll官网:
https://chenxuan1993.gitee.io/component-document/index_prod#/component/seamless-default
  • 实现方式一:npm
  • 命令行执行:
npm install vue-seamless-scroll --save
  • 在main.js文件里面引入使用:
import vueSeamlessScroll from 'vue-seamless-scroll'
Vue.use(vueSeamlessScroll)
  • 在界面文件里面引入使用(代码同实现方式二):
import vueSeamlessScroll from 'vue-seamless-scroll'
  • 实现方式二:引入vue-seamless-scroll.min.js
<template>
  <div class="notice-content">
        <div class="notice-theme-div">
            <img src="img/icons/announ.png" class="notice-img" alt height="18" />
            <span class="notice-theme">{{ infos.servicedesc }}</span>
        </div>
        <!--滚动内容-->
        <vue-seamless-scroll :data="rowsContent" :class-option="optionLeft" class="notice-wrap">
            <span class="notice-span" v-for="(item,index) in rowsContent" :key="index">
                <a :href="item.url">{{ item.title }}</a>
            </span>
        </vue-seamless-scroll >
  </div>
</template>
<script>
import request from "@/utils/request";
import vueSeamlessScroll from "@/utils/vue-seamless-scroll.min.js";
export default {
    components: {
      vueSeamlessScroll
    },
  props: {
    item: Object
  },
    computed: {
      infos() {
        return this.item.items[0];
      },
        optionLeft () {
            return {
                direction: 2
            }
        }
    },
  data() {
    return {
      rowsContent: []
    };
  },
  created() {
    this.getInfos(this.infos);
  },
  methods: {
    getInfos(item) {
            const _self = this;
      const URL = item.url;
      const baseparams = {
        page: 1,
        start: 0,
        limit: 20
      };
      const params = Object.assign({}, baseparams, item.serviceparam);
      request.post(URL, params).then(res => {
        this.rowsContent = res.newsInfos;
      });
    }
};
</script>
<style lang="scss" scoped>
</style>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容