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-27 18:09:23 +08:00
|
|
|
const paramsRegex = /\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)/
|
2020-02-09 19:48:38 +08:00
|
|
|
if (this.NDocRoot.memorizedPath) {
|
|
|
|
const memorizedPath = this.NDocRoot.memorizedPath
|
|
|
|
const currentPath = this.$route.path
|
2020-02-27 18:09:23 +08:00
|
|
|
const memorizedDemoName = (paramsRegex.exec(memorizedPath) || [])[4]
|
|
|
|
const currentDemoName = (paramsRegex.exec(currentPath) || [])[4]
|
2020-02-09 19:48:38 +08:00
|
|
|
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-03-05 22:31:20 +08:00
|
|
|
padding: 32px 24px 24px 56px;
|
2019-10-14 17:49:23 +08:00
|
|
|
}
|
|
|
|
</style>
|