tijiao
This commit is contained in:
24
src/main.js
24
src/main.js
@@ -15,7 +15,24 @@ import Common from './components/common/common'
|
||||
Vue.prototype.$validateString = function (str) {
|
||||
return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str);
|
||||
}
|
||||
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']], // 行内公式
|
||||
displayMath: [['$$', '$$'], ['\\[', '\\]']], // 块级公式
|
||||
},
|
||||
svg: { fontCache: 'global' }
|
||||
};
|
||||
|
||||
// 监听 DOM 变化,并自动渲染公式
|
||||
Vue.prototype.$renderMath = function () {
|
||||
if (window.MathJax && window.MathJax.typeset) {
|
||||
setTimeout(() => {
|
||||
window.MathJax.typeset();
|
||||
}, 100); // 延迟防止 Vue 还未完全渲染
|
||||
} else {
|
||||
console.warn('MathJax 未正确加载');
|
||||
}
|
||||
};
|
||||
import VXETable from 'vxe-table'
|
||||
import 'vxe-table/lib/style.css'
|
||||
|
||||
@@ -146,5 +163,8 @@ router.beforeEach((to, from, next) => {
|
||||
new Vue({
|
||||
router,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
render: h => h(App),
|
||||
mounted() {
|
||||
this.$renderMath(); // 页面加载后自动渲染
|
||||
}
|
||||
}).$mount('#app');
|
||||
|
||||
Reference in New Issue
Block a user