mirror of
https://github.com/youzan/vant.git
synced 2025-10-15 07:30:53 +00:00
fix(@vant/cli): should allow to click anchor (#9434)
* fix(@vant/cli): should allow to click anchor * chore: add
This commit is contained in:
@@ -17,6 +17,24 @@ export default {
|
|||||||
return this.$route.name;
|
return this.$route.name;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const anchors = [].slice.call(this.$el.querySelectorAll('h2, h3, h4, h5'));
|
||||||
|
anchors.forEach((anchor) => {
|
||||||
|
anchor.addEventListener('click', this.scrollToAnchor);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
scrollToAnchor(event) {
|
||||||
|
if (event.target.id) {
|
||||||
|
this.$router.push({
|
||||||
|
name: this.$route.name,
|
||||||
|
hash: '#' + event.target.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
6
packages/vant-cli/site/tsconfig.json
Normal file
6
packages/vant-cli/site/tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true
|
||||||
|
}
|
||||||
|
}
|
@@ -9,5 +9,5 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["esnext", "dom"]
|
"lib": ["esnext", "dom"]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*", "site"]
|
"include": ["src/**/*"]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user