【update】-大屏修改锚点的实现方式

This commit is contained in:
fengchenchen
2023-05-29 10:25:45 +08:00
parent cae2267829
commit 6b5187014d
+7 -1
View File
@@ -9,7 +9,8 @@
v-for="item in menuData"
:key="item.value"
>
<a :href="'#' + item.href">{{ item.name }}</a>
<!--<a :href="'#' + item.href" :key="item.href">{{ item.name }}</a>-->
<div @click="locationDom(item)">{{ item.name }}</div>
</a-menu-item>
</a-menu>
</template>
@@ -165,6 +166,11 @@ export default {
path: '/screen',
})
window.open(routerUrl.href, '_blank')
},
locationDom(item) {
document.querySelector(`#${item.href}`).scrollIntoView({
behavior: 'smooth'
})
}
}
}