deploy to gcloud
This commit is contained in:
1 parent
e4e364ae2a
commit
4b7252c15f
12 files changed
+190
-121
No files matched your search
@@ -47,36 +47,22 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component } from 'nuxt-property-decorator'
|
||||
import { api, THEME } from '~/assets/global'
|
||||
import { Vue, Component, Watch } from 'nuxt-property-decorator'
|
||||
import { THEME } from '~/assets/global'
|
||||
import '~/assets/remark42'
|
||||
|
||||
@Component<PostPage>({
|
||||
async fetch() {
|
||||
const r = await api('/api', {
|
||||
const r = await this.$axios.$get('/api', {
|
||||
params: {
|
||||
path: this.$route.params.pathMatch,
|
||||
},
|
||||
})
|
||||
|
||||
if (r.error) {
|
||||
this.$nuxt.error(r.error)
|
||||
return
|
||||
}
|
||||
|
||||
this.post = r
|
||||
|
||||
setTimeout(() => {
|
||||
if (process.browser) {
|
||||
if (window.REMARK42) {
|
||||
this.initRemark42()
|
||||
} else {
|
||||
window.addEventListener('REMARK42::ready', () => {
|
||||
this.initRemark42()
|
||||
})
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
mounted() {
|
||||
this.initRemark42()
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.remark42Instance) {
|
||||
@@ -99,18 +85,26 @@ export default class PostPage extends Vue {
|
||||
remark42settings = THEME.comment?.remark42 || null
|
||||
remark42Instance: any = null
|
||||
|
||||
@Watch('$fetchState.pending')
|
||||
initRemark42() {
|
||||
if (process.browser && this.remark42settings && window.REMARK42) {
|
||||
if (this.remark42Instance) {
|
||||
this.remark42Instance.destroy()
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
if (
|
||||
this.$refs.remark42 &&
|
||||
process.browser &&
|
||||
this.remark42settings &&
|
||||
window.REMARK42
|
||||
) {
|
||||
if (this.remark42Instance) {
|
||||
this.remark42Instance.destroy()
|
||||
}
|
||||
|
||||
this.remark42Instance = window.REMARK42.createInstance({
|
||||
node: this.$refs.remark42 as HTMLElement,
|
||||
host: this.remark42settings.host,
|
||||
site_id: this.remark42settings.siteId,
|
||||
})
|
||||
}
|
||||
this.remark42Instance = window.REMARK42.createInstance({
|
||||
node: this.$refs.remark42 as HTMLElement,
|
||||
host: this.remark42settings.host,
|
||||
site_id: this.remark42settings.siteId,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user