app.vue
watch: { $route: { handler: function (val, oldVal) { this.$nextTick(function () { //页面加载完成后执行 var inputs = document.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { inputs[i].onblur = function () { document.documentElement.scrollTop = 0; document.body.scrollTop = 0; }; } var textarea = document.getElementsByTagName("textarea"); for (var i = 0; i < textarea.length; i++) { textarea[i].onblur = function () { document.documentElement.scrollTop = 0; document.body.scrollTop = 0; }; } }); }, // 深度观察监听 deep: true, }, },