优化逻辑,切换内容前返回顶部
This commit is contained in:
@@ -248,6 +248,16 @@ export default {
|
||||
|
||||
/** 切换页面 */
|
||||
changePage(categoryName, itemName) {
|
||||
|
||||
/** @type {HTMLElement} */
|
||||
const el = this.$refs['contentWrapper'];
|
||||
|
||||
if (el) {
|
||||
el.scrollTop = 0;
|
||||
} else {
|
||||
console.warn('找不到 content-wrapper 元素。');
|
||||
}
|
||||
|
||||
this.$router.push({
|
||||
name: 'Content',
|
||||
params: {
|
||||
@@ -255,6 +265,7 @@ export default {
|
||||
name: itemName,
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user