mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-17 13:30:35 +03:00
docs(example): optimized selected el
This commit is contained in:
@@ -113,8 +113,24 @@ const titleAndDescMap = transformMd(en);
|
||||
|
||||
const App = {
|
||||
name: 'App',
|
||||
data() {
|
||||
return {
|
||||
currentId: this.getCurrentId(),
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
hljs.initHighlighting();
|
||||
window.onhashchange = () => {
|
||||
this.currentId = this.getCurrentId();
|
||||
};
|
||||
if (this.currentId) {
|
||||
document.getElementById(this.currentId).scrollIntoView();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getCurrentId() {
|
||||
return location.hash.slice(1);
|
||||
},
|
||||
},
|
||||
render(h) {
|
||||
const menus = components.map(item => {
|
||||
@@ -130,6 +146,7 @@ const App = {
|
||||
const props = {
|
||||
id,
|
||||
code,
|
||||
active: id === this.currentId,
|
||||
...titleAndDescMap[id],
|
||||
};
|
||||
return <Card {...{ props }}>{h(component)}</Card>;
|
||||
|
||||
Reference in New Issue
Block a user