Giter Club home page Giter Club logo

mint-loadmore's Introduction

Mint UI

Build Status npm NPM downloads JS gzip size CSS gzip size Join the chat at https://gitter.im/ElemeFE/mint-ui

Mobile UI elements for Vue 2.0

Installation

npm i mint-ui -S

# for Vue 1.x
npm i mint-ui@1 -S

Usage

Import all components.

import Vue from 'vue';
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';

Vue.use(Mint);

Or import specified component. (Use babel-plugin-component)

import { Cell, Checklist } from 'mint-ui';

Vue.component(Cell.name, Cell);
Vue.component(Checklist.name, Checklist);

Equals to

import Vue from 'vue';
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';

Vue.use(Mint);

// import specified component

import MtRadio from 'mint-ui/lib/radio';
import 'mint-ui/lib/radio/style.css';

Vue.component(MtRadio.name, MtRadio);

babel-plugin-component

  • Auto import css file
  • Modular import component

Installation

npm i babel-plugin-component -D

Usage

.babelrc

{
  "plugins": ["other-plugin", ["component", [
    { "libraryName": "mint-ui", "style": true }
  ]]]
}

CDN

RawGit

NPMCDN

Development

npm run dev

Contribution

Please make sure to read the Contributing Guide before making a pull request.

License

MIT

mint-loadmore's People

Contributors

cyio avatar leopoldthecoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mint-loadmore's Issues

下拉加载更多无法触发下拉方法 也没有下拉效果

{{roomName | sub(1)}}
在线{{onlineNum}}人  /  成员{{memberNum}}
返回
搜寻

{{list.account}} 在线

{{list.user_nick}}

<script> import Spinner from 'mint-ui/lib/spinner' // 按需加载mint-ui的模块 import Loadmore from 'mint-ui/lib/loadmore' // 按需加载mint-ui的模块 import { mapState } from 'vuex' import Vue from 'vue' Vue.component(Spinner.name, Spinner) Vue.component(Loadmore.name, Loadmore) export default { name: 'houseList', data () { return { chatRoomMemberList: [], searchValue: '', allLoaded: false, pageNo: 1, isHaveMoreData: true, moreText: '', // 更多文字 topStatus: '', bottomStatus: '' } }, computed: { ...mapState({ roomName: state => state.chat.roomName, onlineNum: state => state.chat.onlineNum, memberNum: state => state.chat.memberNum, roleType: state => state.chat.roleType, accountId: state => state.chat.accountId, roomId: state => state.chat.roomId }) }, methods: { loadTop () { // 加载更多数据 this.pageNo = 1 this.allLoaded = false // 下拉加载后重置滑动加载 this.getMemberList(this.pageNo, 0) this.$refs.loadmore.onTopLoaded() }, loadBottom () { if (this.isHaveMoreData) { this.pageNo++ this.getMemberList(this.pageNo, 1) this.allLoaded = false } else { this.$refs.loadmore.onBottomLoaded() } }, handleTopChange (status) { this.topStatus = status }, handleBottomChange (status) { this.bottomStatus = status }, saySlience (accountId, accountType, speakStatus, index) { this.$store.dispatch('chat.updatechatRoomUserSpeakStatus.action', {roomId: this.roomId, accountId: accountId, accountType: accountType, speakStatus: speakStatus}).then((res) => { if (res.status === window.common.statusConst.SUCCESS) { if (speakStatus) { this.$set(this.chatRoomMemberList[index], 'speakStatus', 0) } else { this.$set(this.chatRoomMemberList[index], 'speakStatus', 1) } } }) }, getMemberList (pageNo, type) { this.$store.dispatch('chat.getChatRoomMemberList.action', {roomId: this.roomId, userAccount: '', pageNum: pageNo}).then(res => { if (res.status === window.common.statusConst.SUCCESS) { if (res.data.length === 0) { this.allLoaded = true } // 向上 if (Number(type) === 0) { this.chatRoomMemberList = res.data } else { // 向下 if (res.data.length < 20) { this.isHaveMoreData = false } else { this.isHaveMoreData = true } this.chatRoomMemberList = this.chatRoomMemberList.concat(res.data) this.$refs.loadmore.onBottomLoaded() } } else { this.isHaveMoreData = false this.$refs.loadmore.onBottomLoaded() } }) }, upgradeMember (userId, index) { this.$store.dispatch('chat.upgradeMemberLevel.action', {roomId: this.roomId, accountId: userId}).then(res => { if (res.status === window.common.statusConst.SUCCESS) { this.$set(this.chatRoomMemberList[index], 'roleType', 1) } }) }, delMember (accountId, roleType, index) { this.$store.dispatch('chat.delChatRoomMember.action', {roomId: this.roomId, accountId: accountId, roleType: roleType}).then(res => { if (res.status === window.common.statusConst.SUCCESS) { this.chatRoomMemberList.splice(index, 1) } }) }, searchUser () { this.$store.dispatch('chat.getChatRoomMemberList.action', {roomId: this.roomId, userAccount: this.searchValue, pageNum: 1}).then(res => { if (res.status === window.common.statusConst.SUCCESS) { this.chatRoomMemberList = res.data } }) }, delgradeMember (accountId, index) { this.$store.dispatch('chat.downgradeMember.action', {roomId: this.roomId, accountId: accountId}).then(res => { if (res.status === window.common.statusConst.SUCCESS) { this.$set(this.chatRoomMemberList[index], 'roleType', 2) } }) } }, components: {}, created () { this.getMemberList(1) }, watch: { } } </script>

上拉加载问题

当加载内容超出屏幕可视区域,scroll会下移,拜托是什么原因

不能正常滑动

example中 在小步滑动的时候会反弹,this.getScrollTop(this.scrollEventTarget) 始终为 0,导致每次都会触发下拉事件

滑动时带动父元素运动

在滑动时使用flex的父元素会跟着跳动
添加cancelable=false可以解决问题么?可以的话,应该添加到哪里?

loadmore里面的for循环会走多次

我没有在created或者beforeMounted里面初始化loadmore所需要的数据,而是在让loadmore第一次直接调用loadBottom,实际上只有三条数据,可是循环出了九条数据,这是为啥?

动态加载数据后不能上拉

参照DEMO的示例,用FOR循环PUSH进去可以出现上拉效果,但是用AJAX请求回来的数据,PUSH进去之后,缺不能触发上拉效果?为什么呢?

代码同mint-ui同步

mint-ui里使用的mint-loadmore版本是0.0.4,当前仓库为0.0.3

能否将两边同步起来

谢谢

translate 的值不能写死 50px

translate 的值不能写死 50 应该获取 .mint-loadmore-top.mint-loadmore-bottom 元素的高度
虽然说加载提示的文字没人会把提示语写很长 也就是说高度保持不变
但是还有一种特殊情况 就是在页面缩放 (dpr=2) 的情况下 这里的 50px 相当于 dpr=125px
这种情况下就会导致 "加载中" 的提示只能显示一半 因为实际 100px 才等于 dpr=150px

bottom-method 时间绑定

给bottom-method绑定了一个事件。为什么在页面加载的时候就触发了这个事件并且执行

ReferenceError: _h is not defined

按照文档来,但是老是报这个错,不明白到底是为什么?
// ES6 mudule
import Loadmore from 'vue-loadmore';
Vue.component('loadmore', Loadmore);


就这样写的啊?哪里的问题?

初始化loadmore出现错误,哪里出现错误了

<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>

image
image

上拉加载无上拉效果,也不会触发方法

<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>

Work on desktop ?

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.

在IOS中发现一个BUG

ios 系统浏览器高度+反弹高度是不会等于 document.body.scrollHeight,在这个方法中checkBottomReached做了以下优化:

document.body.scrollTop + document.documentElement.clientHeight >= document.body.scrollHeight :
this.$el.getBoundingClientRect().bottom <= this.scrollEventTarget.getBoundingClientRect().bottom

上拉刷新-android

vue v1.0.26
android: 4.4.2 lenovoK920
loadmore 里面放一个mint的 swipe 和一个ul列表
android 和 chrome模拟 模式下都不能上拉刷新,
ios能用,但是不是很好用

下拉刷新可以用

关于 externals 和多配置文件

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

vue 2.1.10用不了

VUE 2.1.10 用不了,全局引入报递归组件需要name属性,但是插件是有的。在组件里面引入报
[Vue warn]: Error when rendering component : Uncaught ReferenceError: _h is not defined

按照demo使用都无法使用

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.