vue无线滚动组件封装
2024-09-05 20:16:37
<template>
<div class="scroll-wapper" :style="{height: scrollHeight + 'px'}" id="scroll-ul">
<ul class="list" v-infinite-scroll="loadMore" infinite-scroll-disabled="loading"
infinite-scroll-distance="10">
<slot>
<div class="tip">
<div class="logo">
<img v-if="tip.img" :src="tip.img"/>
<span v-if="tip.icon" class="iconfont" v-html="tip.icon"></span>
</div>
<p>{{tip.title}}</p>
<button v-if="tip.btn" @click="go">{{tip.btn}}</button>
</div>
</slot>
</ul>
</div>
</template>
<script>
import { InfiniteScroll, Indicator } from "mint-ui";
import defaultImg from "../../../assets/images/good-tip.png"; export default {
data() {
return {
length: true
// height: {
// height: this.scrollHeight
// }
};
},
mounted() {
// console.log(this.scrollHeight)
},
methods: {
loadMore() {
this.loadingHandle();
this.$emit("loadMore");
},
loadingHandle() {
Indicator.open({
text: "加载中",
spinnerType: "fading-circle"
});
}, },
props: {
loading: {
type: Boolean,
default() {
return false;
}
},
tip: {
type: Object,
default() {
return {
img: defaultImg,
title: "暂时没有哦!",
btn: ""
};
}
},
scrollHeight: {
type: Number,
default() {
return 200;
}
}
}
};
</script>
外部需传入scrollHeight属性,是该滚动容器的高度,后可以根据实际情况使用
最新文章
- [HTML5] ArrayBuffer与类型化数组
- SQL怎么输出前n个记录? n是中间计算得到的,不支持变量传递
- qt 4.6.2 与visual studio 2005 集成(编译方法,以及中间遇到的问题)
- 2.里氏替换原则(Liskov Substitution Principle)
- 对 Sea.js 进行配置(一) seajs.config
- 云计算服务模型,第 1 部分: 基础架构即服务(IaaS)
- systemtap 列出所有linux 内核模块与相关函数2
- CentOS源码安装搭建LNMP全过程(包括nginx,mysql,php,svn)【转】
- [视频转换] C#VideoConvert视频转换帮助类 (转载)
- CC++初学者编程教程(4) 安装Oracle12c于Windows Sever2012
- DDD实践(一)
- html学习笔记 - 标签
- C语言运算符运算顺序判断实例1
- UVA 11292 Dragon of Loowater(简单贪心)
- Oracle课程档案,第二天
- 最短路径spfa
- 0006-20180422-自动化第七章-python基础学习笔记
- MySQL空间索引简单使用
- Nginx常用功能
- Web安全颜色