Rely on undefined check for #583

This commit is contained in:
rijkvanzanten
2020-10-08 09:08:20 -04:00
parent 0a27e4a708
commit 045aa613e2

View File

@@ -59,7 +59,7 @@ export default defineComponent({
},
setup() {
const markdown = ref('');
const view = ref<Vue | null>(null);
const view = ref<Vue>();
const title = computed(() => {
const firstLine = markdown.value.split('\n').shift();
@@ -73,8 +73,7 @@ export default defineComponent({
});
onUpdated(() => {
if(view.value === null) return
view.value.$data.contentEl?.scrollTo({ top: 0 });
view.value?.$data.contentEl?.scrollTo({ top: 0 });
});
return { markdown, title, markdownWithoutTitle, view };