鍍金池/ 問答/HTML/ (急-懸賞解決)vue+mui 上拉刷新和下拉加載無效

(急-懸賞解決)vue+mui 上拉刷新和下拉加載無效

第一次打開的時候是沒有問題id,第二次(切換路由到其他頁面,再回來就沒用了);
在生命周期方法created,updated mounted中都試過了,還是無效,啊 氣瘋了!求幫忙解決啊!!!

<template>
    <div>
        <div class="mui-content">
            <!--下拉刷新容器-->
            <div id="lists" class="mui-content mui-scroll-wrapper" style="margin-bottom: 4rem;">
                <div class="mui-scroll">
                    <!--數據列表-->
                    <ul class="mui-table-view mui-table-view-chevron">
                        <li class="mui-table-view-cell" v-for="(topic,index) of topics"><a class="mui-navigate-right">Item {{index}}</a></li>
                    </ul>
                </div>
            </div>
        <nav-components></nav-components>
        </div>
    </div>
</template>
<script scoped>

    import navComponents from './nav.vue'

    export default {
        components: {navComponents},
        name: "index",
        data() {
            return {
                topics: [],
            }
        },
        methods: {
            pulldownRefresh: function () {
                alert();
            },
            pullupRefresh: function () {
                var count = 0;
                var that = this;
                setTimeout(function() {
                    that.topics.push({
                        "id": 14,
                        "content": "xxxxx。",
                        "clicl_number": 0,
                        "support_number": 0,
                        "create_time": "2018年07月23日 17:02:04",
                        "user": {
                            "nickname": "測試賬戶002",
                            "face_url": "http://thinkpjax.cn/xxxxxxx.jpeg"
                        }
                    });
                }, 1500);
            }
        },
        mounted: function () {
            var that = this;
            mui("#lists").scroll({
                deceleration: 0.0006,
                scrollY: true, //是否豎向滾動
                bounce: true,    ///是否啟用回彈
            });
            
        },
        created(){
            mui.init({
                pullRefresh: {
                    container: '#lists',
                    up: {//上拉加載
                        auto:true,//可選,默認false.自動上拉加載一次
                        contentrefresh: '正在加載...',
                        contentnomore:'沒有更多數據了',//可選,請求完畢若沒有更多數據時顯示的提醒內容;
                        callback: this.pullupRefresh
                    }
                }
            });
        },
    }
</script>
回答
編輯回答
朽鹿

mui.init()不執(zhí)行,我也碰到這個問題了,樓主是咋解決的

2017年12月2日 22:01
編輯回答
尛曖昧

你的 router-view 是不是用 keep-alive 包裹了? 這樣子的話 createdmounted 在路由在再次切進來時是不會觸發(fā)的.

2017年12月31日 20:43