justforuse / vue-mathjax-next

Vue3 + Mathjax plugin
https://vue-mathjax-next.vercel.app/
29 stars 2 forks source link

网络获取数据显示[Vue warn]: Unhandled error during execution of mounted hook #24

Closed GuooGaii closed 8 months ago

GuooGaii commented 8 months ago
# HelloWorld.vue

<template>
  <vue-mathjax v-if="question" :formula="question.answer" />
</template>

<script setup>

import { ref, onMounted } from "vue";
import axios from "axios";

const question = ref(null);

const getQuestion = async () => {
  try {
    const res = await axios.get("http://localhost:5000/get-question/1");
    question.value = res.data;
  } catch (error) {
    console.error('Error fetching question:', error);
  }
};

onMounted(() => {
  getQuestion();
});

</script>

index.html和main.js已经正确配置,demo的静态公式可以成功渲染,后端获取的数据无法渲染