function toPath(
name: string,
index: number,
handleChange: (index: number) => void
) {
showMr.value = name;
handleChange(index); //滚动
}
handleChange是回调函数
function handleChange(index: number) {
console.log('Callback function');
}
再按钮@click事件中使用
<div @click="toPath(j.va, index, handleChange)"/>
onMounted(() => {
toPath(showMr.value, 0, function name() {});
});