[Client] Load katex async to reduce bundle size
This commit is contained in:
		
							parent
							
								
									83a3426dd5
								
							
						
					
					
						commit
						37e3d60ade
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
					@ -4,7 +4,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script lang="ts">
 | 
					<script lang="ts">
 | 
				
			||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
import * as katex from 'katex';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default Vue.extend({
 | 
					export default Vue.extend({
 | 
				
			||||||
	props: {
 | 
						props: {
 | 
				
			||||||
| 
						 | 
					@ -13,10 +12,14 @@ export default Vue.extend({
 | 
				
			||||||
			required: true
 | 
								required: true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	computed: {
 | 
						data() {
 | 
				
			||||||
		compiledFormula(): any {
 | 
							return {
 | 
				
			||||||
			return katex.renderToString(this.formula);
 | 
								compiledFormula: null
 | 
				
			||||||
		}
 | 
							};
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						async created() {
 | 
				
			||||||
 | 
							const katex = await import('katex').then(m => m.default);
 | 
				
			||||||
 | 
							this.compiledFormula = katex.renderToString(this.formula);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue