Vuejs2 如何使用vue正确显示mathml?

Vuejs2 如何使用vue正确显示mathml?,vuejs2,mathml,Vuejs2,Mathml,我有很多html片段,其中嵌入了一些mathml标记,如下所示: <span lang="EN-US" style='font-size:10.5pt;font-family:等线;position:relative;'><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">&

我有很多html片段,其中嵌入了一些mathml标记,如下所示:

<span lang="EN-US" style='font-size:10.5pt;font-family:等线;position:relative;'><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>a</mml:mi><mml:mo>&gt;</mml:mo><mml:mn>2</mml:mn></mml:math></span>
a2
如果我从服务器检索它并将其显示在Home.vue中,则数学公式不会正确显示,只显示纯文本

如果将其放置在独立html文件中,则浏览器可以正确显示它,独立html文件如下所示:

<html xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body lang="ZH-CN">
<div class="WordSection1" style='layout-grid:15.6pt'>

<p class="MsoNormal"><span lang="EN-US" style='font-size:10.5pt;font-family:等线;position:relative;'><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>a</mml:mi><mml:mo>&gt;</mml:mo><mml:mn>2</mml:mn></mml:math></span>
</p>
</div>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</body>
</html>

a2

注意:我将xmlns:mml和xmlns:m放在vue项目的index.html中,并在正文部分的末尾添加了两个脚本标记,如上所述,但在使用“npm run start”运行项目时,会出现一些错误,如:

[Vue warn]: Unknown custom element: <mml:math> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <Home> at src/main/webapp/app/core/home/home.vue
       <App> at src/main/webapp/app/app.vue
         <Root>
[Vue warn]:未知自定义元素:-您是否正确注册了组件?对于递归组件,请确保提供“name”选项。
发现于
--->位于src/main/webapp/app/core/home/home.vue
位于src/main/webapp/app/app.vue

有什么想法吗?我不想更改html代码段,因为它的数量很大。

您可以尝试将
v-pre
指令添加到
标记中,或者在Vue全局配置()@IVO GELOV中使用
ignoredElements
,谢谢,ignoreElements可以工作!!警告已经过去了。但是,数学公式仍然是纯文本,似乎index.html(webapp/index.html)中的mathjax脚本文件在vue中不起作用?@IVO GELOV,可能已解决(firefox工作,但chrome不工作),我将重试,可能缓存未清除,谢谢。您可以尝试将
v-pre
指令添加到
标记中,或在Vue全局配置()@IVO GELOV中使用
ignoredElements
,谢谢,ignoreElements有效!!警告已经过去了。但是,数学公式仍然是纯文本的,似乎index.html(webapp/index.html)中的mathjax脚本文件在vue中不起作用?@IVO GELOV,可能已解决(firefox有效,但chrome无效),我将重试,可能缓存未清除,谢谢。