refactor: formula-core.vue to composition api

This commit is contained in:
Norm 2022-08-19 16:02:51 -04:00
parent b3b8e56092
commit e8414e8c8d
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -4,29 +4,18 @@
<span v-else v-html="compiledFormula"></span> <span v-else v-html="compiledFormula"></span>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue'; import { computed } from 'vue';
import katex from 'katex'; import katex from 'katex';
export default defineComponent({ const props = defineProps<{
props: { formula: string;
formula: { block: boolean;
type: String, }>();
required: true,
}, const compiledFormula = computed(() => katex.renderToString(props.formula, {
block: { throwOnError: false,
type: Boolean, }));
required: true,
},
},
computed: {
compiledFormula(): any {
return katex.renderToString(this.formula, {
throwOnError: false,
} as any);
},
},
});
</script> </script>
<style> <style>