需要使用ref来进行实现
<div class="center-bj-one" ref="containerRef"> <div class="center" v-for="item in list" :key="item"> <div class="center-nr">{{ item }}</div> </div> </div> import {ref, nextTick, watch} from "vue"; const list = ref<string[]>([]); watch(()=> list.value.length,()=>{ nextTick(()=>{ scrollBottom(); },100); }) const scrollBottom = ()=> { containerRef.value.scrollTop = containerRef.value.scrollHeight; }