blog icon indicating copy to clipboard operation
blog copied to clipboard

update期间无限循环渲染错误

Open yongheng2016 opened this issue 7 years ago • 0 comments

image

<div class="dataItem" ref="dataItem" v-for="(item, index) in dateDataList">
    <div class="date">
        <div class="month">{{filterDate(item.coreBloodSugarDate)}}</div>
    </div>
</div>
export default {
    methods: {
            filterDate(date){
                let temp = date.split('-')
                //==============无线循环渲染===========( [Vue warn]: You may have an infinite update loop in a component render function.)
                // this.year = temp[0]
                // (render-->reversedMessage --> render) 在update期间调用
                // this.year导致试图更新,试图更新又会调用reversedMessage函数,如此循环
                //=====================end============
                temp =  temp[1]+'-'+temp[2]
                return temp
            }, 
    }
}

yongheng2016 avatar Dec 14 '17 12:12 yongheng2016