[Client] Load katex async to reduce bundle size
This commit is contained in:
		| @@ -4,7 +4,6 @@ | ||||
|  | ||||
| <script lang="ts"> | ||||
| import Vue from 'vue'; | ||||
| import * as katex from 'katex'; | ||||
|  | ||||
| export default Vue.extend({ | ||||
| 	props: { | ||||
| @@ -13,10 +12,14 @@ export default Vue.extend({ | ||||
| 			required: true | ||||
| 		} | ||||
| 	}, | ||||
| 	computed: { | ||||
| 		compiledFormula(): any { | ||||
| 			return katex.renderToString(this.formula); | ||||
| 		} | ||||
| 	data() { | ||||
| 		return { | ||||
| 			compiledFormula: null | ||||
| 		}; | ||||
| 	}, | ||||
| 	async created() { | ||||
| 		const katex = await import('katex').then(m => m.default); | ||||
| 		this.compiledFormula = katex.renderToString(this.formula); | ||||
| 	} | ||||
| }); | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo