<div id="ttt" style="padding-bottom:100px;border: 1px solid green">
<div v-for="(comment, index) in comments">
<div>
<p v-text="comment"></p>
</div>
</div>
<button class="btn" @click="showMore">
Show More
</button>
</div>
<script>
new Vue({
el: '#ttt',
data: {
comments: ['tom', 'jack' ,'lily'],
},
methods: {
showMore() {
this.comments = this.comments.concat(['mary', 'jessica'])
}
},
});
</script>
1
IvanLi127 2020-10-05 23:38:24 +08:00 via Android
插入前记下滚动条位置,插完后滚立马回来。 css 有一个属性能控制,overflow-anchor 。
|