mint-ui / mint-loadmore Goto Github PK
View Code? Open in Web Editor NEWA two-direction mobile load-more component for vue.js
License: MIT License
A two-direction mobile load-more component for vue.js
License: MIT License
https://webpack.github.io/docs/library-and-externals.html#comment-2002619793
文档上的一条评论里介绍了可以针对不同模式配置
cooking.add('externals.vue', 'vue');
可以改为
cooking.add('externals.vue', {
root: 'Vue', // window.Vue
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
});
现在 cooking 支持运行多配置文件,传入文件数组(逗号分隔),如果有配置中有用 server 只会启动最后一个文件的 server
cooking watch -c cooking.conf.js,cooking.example.conf.js
当加载内容超出屏幕可视区域,scroll会下移,拜托是什么原因
VUE 2.1.10 用不了,全局引入报递归组件需要name属性,但是插件是有的。在组件里面引入报
[Vue warn]: Error when rendering component : Uncaught ReferenceError: _h is not defined
按照demo使用都无法使用
我的项目使用的是vue-webpack-boilerplate
然后再引入css文件require('mint-loadmore/lib/index.css');
的时候报错了
不管是在<script>'还是
<style>`里面都不可以
在iOS平台使用fastclick来解决延迟问题,但是在下拉刷新、上拉加载下一页,都会触发列表项目的点击事件,导致进入详情页了,这个如何解决?
IOS,先上拉加载更多,然后在下拉刷新页面。这个下拉刷新页面就很难触发,topPullText 也显示不出来。
demo里也是没有
下拉打算查看下面的数据,但是他会处罚上面的刷新方法,上拉的时候也是会出现处罚下拉的方法。
本来没有啥问题。后来引入vuex后,如何在action触发this.$broadcast('onTopLoaded', id);??
目前做法是action加入promise, 在method中包装action,then触发$broadcast,但是感觉不合理
按照文档来,但是老是报这个错,不明白到底是为什么?
// ES6 mudule
import Loadmore from 'vue-loadmore';
Vue.component('loadmore', Loadmore);
就这样写的啊?哪里的问题?
ios 系统浏览器高度+反弹高度是不会等于 document.body.scrollHeight,在这个方法中checkBottomReached做了以下优化:
document.body.scrollTop + document.documentElement.clientHeight >= document.body.scrollHeight :
this.$el.getBoundingClientRect().bottom <= this.scrollEventTarget.getBoundingClientRect().bottom
vue.common.js?6ef8:521 [Vue warn]: Error when rendering component :
vue.common.js?6ef8:435 ReferenceError: _h is not defined(…)
<template>
<div>
<loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore">
<ul>
<li v-for="item in list">{{ item }}</li>
</ul>
</loadmore>
</div>
</template>
<script type="text/javascript-6">
import loadmore from 'vue-loadmore';
export default {
data(){
return {
list: [],
allLoaded: false
}
},
components:{
loadmore
},
methods:{
loadTop(id){
console.log(1);
this.$refs.loadmore.onTopLoaded();
},
loadBottom(id) {
this.allLoaded = true;// 若数据已全部获取完毕
this.$refs.loadmore.onBottomLoaded();
}
}
}
</script>
<style scoped>
</style>
给bottom-method绑定了一个事件。为什么在页面加载的时候就触发了这个事件并且执行
页面会自动下拉
Has a error with SSR.
ReferenceError: _h is not defined
vue v1.0.26
android: 4.4.2 lenovoK920
loadmore 里面放一个mint的 swipe 和一个ul列表
android 和 chrome模拟 模式下都不能上拉刷新,
ios能用,但是不是很好用
下拉刷新可以用
运用起来 报错,如下
[Vue warn]: Error when rendering component :
Uncaught ReferenceError: _h is not defined
我没有在created或者beforeMounted里面初始化loadmore所需要的数据,而是在让loadmore第一次直接调用loadBottom,实际上只有三条数据,可是循环出了九条数据,这是为啥?
Hey,
Is it working also on Desktop ? or only on mobile device ?
I would like to implement it for a desktop and mobile application.
Load more with scroll on desktop.
场景是这样
列表页,使用loadmore
详细页查阅后再返回列表页,不能停留在上一页的进来的位置
如题
当第一次返回的数据为空的时候 不能再次下拉刷新了,不知道怎么处理呢?
参照DEMO的示例,用FOR循环PUSH进去可以出现上拉效果,但是用AJAX请求回来的数据,PUSH进去之后,缺不能触发上拉效果?为什么呢?
代码如下:
<loadmore :bottom-method="onPullup"
bottom-pull-text="上拉加载更多"
bottom-loading-text="松开进行加载"
:bottom-all-loaded="!hasMore">
<div>
<product-item v-for="item of products"
@onbuy="onBuy"
@click="onProductItemClick(item)"
:product="item">
</product-item>
</div>
</loadmore>
mint-ui里使用的mint-loadmore版本是0.0.4,当前仓库为0.0.3
能否将两边同步起来
谢谢
在滑动时使用flex的父元素会跟着跳动
添加cancelable=false可以解决问题么?可以的话,应该添加到哪里?
因为容易要居中显示,所有父容器用了absolute,加了top:1rem的属性,(APP 的头尾占据了一定的位置), 然后下拉刷新就突然没效果了. 用了topDistance 自己了加了 值 还是没效果 而demo是文档流 不知道出了什么问题
<template>
<div class="page health-tips">
<common-header></common-header>
<section class="no-footer">
<load-more :bottom-method="loadBottom" :bottom-status.sync="bottomStatus" :bottom-distance="distance" :auto-fill="autoFill">
<div>
<div class="text-img-card" v-for="tip in tips" v-link="{path: '/' + $route.pageData.modelName + '/' + $index+ '/' + tip.id}" track-by="$index">
<div class="image" v-if="tip.image"><img :src="tip.image"></div>
<div class="title">{{tip.title}}</div>
<p class="content">{{{tip.content}}}</p>
</div>
</div>
</load-more>
<toast type="loading" v-show="loadingData">数据加载中</toast>
</section>
</div>
</template>
<style lang="less" rel="stylesheet/less" scoped>
@import '../assets/var';
section {
padding: 36/@rem 36/@rem 50px 36/@rem;
background: #f6f6f6;
}
.text-img-card {
padding: 20/@rem;
.boxShadowForBlock;
background-color: #fff;
margin-bottom: 20/@rem;
border-radius: 6px;
.image {
width: 100%;
img {
width: 100%;
}
}
.title {
height: 70/@rem;
display: flex;
align-items: center;
font-size: 30/@rem;
}
.content {
font-size: 24/@rem;
color: #999;
}
}
</style>
<script>
import loadMore from 'mint-loadmore'
import commonHeader from './header'
import toast from './toast'
import store from './store/health-tips'
let getType = function (o) {
return ({}).toString.call(o).replace(/\[object\s(.*)\]/, '$1').toLowerCase();
};
//todo:加载更多
export default{
data(){
let self = this;
return {
loadingData: false,
tips: [],
currentPage: 1,
lastPage: 1,
total:1,
distance: 120,
bottomStatus: '',
autoFill: false,
queryType:(function (me) {
let type = 0;
switch (me.$route.pageData.modelName){
case 'medical_guide':
type = 1;
break;
case 'health_tips':
type = 2;
break;
}
return type;
})(self)
}
},
components:{
commonHeader,
toast,
loadMore
},
methods:{
loadBottom(id){
this.$resource(`/api/article?type=${this.queryType}&page=${this.nextPage}`).query().then(function (res) {
store.tips = res.data;
this.currentPage = store.tips.current_page;
this.lastPage = store.tips.last_page;
this.total = store.tips.total;
let l = store.tips.data.length, i = 0;
for(; i < l; i++){
this.tips.push(store.tips.data[i]);
}
this.$broadcast('onBottomLoaded', id);
});
},
a(){
console.log(1);
}
},
route: {
data (transition){
this.loadingData = true;
this.$resource(`/api/article?type=${this.queryType}&page=${this.currentPage}`).query().then(function (res) {
this.loadingData = false;
store.tips = res.data;
transition.next({
tips: store.tips.data,
currentPage: store.tips.current_page,
lastPage: store.tips.last_page,
total: store.tips.total
});
});
}
}
}
</script>
translate
的值不能写死 50 应该获取 .mint-loadmore-top
和 .mint-loadmore-bottom
元素的高度
虽然说加载提示的文字没人会把提示语写很长 也就是说高度保持不变
但是还有一种特殊情况 就是在页面缩放 (dpr=2)
的情况下 这里的 50px
相当于 dpr=1
的 25px
这种情况下就会导致 "加载中" 的提示只能显示一半 因为实际 100px
才等于 dpr=1
的 50px
example中 在小步滑动的时候会反弹,this.getScrollTop(this.scrollEventTarget) 始终为 0,导致每次都会触发下拉事件
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.