<form class="a" id="b" v-if="a_show">
</form>
我的页面上有很多这样的表单,每一个都是通过一个v-if来手动控制显示的。我想实现每当我这个a_show为true了,即表单出现时,滚动条自动滑到最底部,用vue.js。
一开始想到watch,但是watch只能监视数据。所以应该怎么做呢?
谢谢指导
以下两种都无效
created:function(){
window.onresize = function(){
if(document.getElementById('b')){
document.getElementById('b').scrollIntoViewIfNeeded();
}
};
mounted:function(){
window.onresize = function(){
if(document.getElementById('b')){
document.getElementById('b').scrollIntoViewIfNeeded();
}
};
相关分类