2019-09-21 17:03:37 +08:00
|
|
|
<template>
|
2019-10-14 17:49:23 +08:00
|
|
|
<div class="n-documentation">
|
2019-09-21 17:03:37 +08:00
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
</template>
|
2019-10-14 17:49:23 +08:00
|
|
|
|
2020-02-01 16:45:37 +08:00
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
inject: {
|
|
|
|
NDocRoot: {
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted () {
|
2020-02-09 19:48:38 +08:00
|
|
|
const paramsRegex = /\/([^/]+)\/([^/]+)\/([^/]+)/
|
|
|
|
if (this.NDocRoot.memorizedPath) {
|
|
|
|
const memorizedPath = this.NDocRoot.memorizedPath
|
|
|
|
const currentPath = this.$route.path
|
|
|
|
const memorizedDemoName = (paramsRegex.exec(memorizedPath) || [])[3]
|
|
|
|
const currentDemoName = (paramsRegex.exec(currentPath) || [])[3]
|
|
|
|
if (
|
|
|
|
memorizedDemoName &&
|
|
|
|
currentDemoName &&
|
|
|
|
memorizedDemoName !== currentDemoName
|
|
|
|
) {
|
|
|
|
this.NDocRoot.resetScrollPosition()
|
|
|
|
}
|
|
|
|
}
|
2020-02-01 16:45:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-14 17:49:23 +08:00
|
|
|
<style>
|
|
|
|
.n-documentation {
|
2020-01-27 21:14:34 +08:00
|
|
|
padding: 24px 24px 24px 56px;
|
2019-10-14 17:49:23 +08:00
|
|
|
}
|
|
|
|
</style>
|