md-editor-v3
md-editor-v3 copied to clipboard
加载<md-editor>时报错:Cannot read properties of undefined (reading 'value')
环境:
- [email protected]
- vite+vue3
- tailwindcss(这个不知道有没有影响)
报错信息:
Uncaught TypeError: Cannot read properties of undefined (reading 'value')
at barRender (md-editor-v3.es.js:1739:34)
at md-editor-v3.es.js:2295:60
at Array.map (<anonymous>)
at Proxy.<anonymous> (md-editor-v3.es.js:2295:43)
at renderComponentRoot (runtime-core.esm-bundler.js:896:44)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5580:57)
at ReactiveEffect.run (reactivity.esm-bundler.js:185:25)
at instance.update (runtime-core.esm-bundler.js:5694:56)
at setupRenderEffect (runtime-core.esm-bundler.js:5708:9)
at mountComponent (runtime-core.esm-bundler.js:5490:9)
md-editor-v3.es.js 第1729行:
const barRender = (barItem) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O;
if (allToolbar.includes(barItem)) {
switch (barItem) {
case "-": {
return createVNode(Divider, null, null);
}
case "bold": {
return createVNode("div", {
"class": `${prefix}-toolbar-item`,
"title": (_a = ult.value.toolbarTips) == null ? void 0 : _a.bold,
"onClick": () => {
emitHandler("bold");
}
}, [createVNode("svg", {
"class": `${prefix}-icon`,
"aria-hidden": "true"
}, [createVNode("use", {
"xlink:href": "#icon-bold"
}, null)])]);
}
case "underline": {
return createVNode("div", {
"class": `${prefix}-toolbar-item`,
"title": (_b = ult.value.toolbarTips) == null ? void 0 : _b.underline,
"onClick": () => {
emitHandler("underline");
}
}, [createVNode("svg", {
"class": `${prefix}-icon`,
"aria-hidden": "true"
}, [createVNode("use", {
"xlink:href": "#icon-underline"
}, null)])]);
}
App.vue:
<template>
<md-editor language="zh-CN" />
</template>
<script>
import { defineComponent } from "vue";
import MdEditor from "md-editor-v3";
import "md-editor-v3/lib/style.css";
export default defineComponent({
name: "App",
components: {
MdEditor,
},
data() {
return {
text: "# 这是标题",
};
},
methods: {
onChange(val) {},
onUploadImg(files) {
console.log(Array.from(files));
},
},
});
</script>
能给一份最简可运行的环境代码吗?zip或者仓库都可以
感谢回复!代码在附件zip中。
Robin @.***
------------------ 原始邮件 ------------------ 发件人: "imzbf/md-editor-v3" @.>; 发送时间: 2022年8月5日(星期五) 中午12:30 @.>; @.@.>; 主题: Re: [imzbf/md-editor-v3] 加载<md-editor>时报错:Cannot read properties of undefined (reading 'value') (Issue #147)
能给一份最简可运行的环境代码吗?zip或者仓库都可以
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
附件是不是漏了?没收到呢
你好!我重新看了一下,好像是有附件的。我把附件重新发一遍吧,如果你在附件没有看到的话,我上传到了百度网盘,链接如下: https://pan.baidu.com/s/14iysw4S484uUMjYCwmnM6Q 提取码是:4rxt
Robin @.***
------------------ 原始邮件 ------------------ 发件人: "imzbf/md-editor-v3" @.>; 发送时间: 2022年8月7日(星期天) 下午3:47 @.>; @.@.>; 主题: Re: [imzbf/md-editor-v3] 加载<md-editor>时报错:Cannot read properties of undefined (reading 'value') (Issue #147)
附件是不是漏了?没收到呢
Robin @.***> 于2022年8月5日周五 15:36写道:
> 感谢回复!代码在附件zip中。 > > > > > Robin > @.*** > > > > > > > > > ------------------ 原始邮件 ------------------ > 发件人: "imzbf/md-editor-v3" @.>; > 发送时间: 2022年8月5日(星期五) 中午12:30 > @.>; > @.@.>; > 主题: Re: [imzbf/md-editor-v3] 加载<md-editor>时报错:Cannot read > properties of undefined (reading 'value') (Issue #147) > > > > > > > 能给一份最简可运行的环境代码吗?zip或者仓库都可以 > > — > Reply to this email directly, view it on GitHub, or unsubscribe. > You are receiving this because you authored the thread.Message ID: > @.> > > — > Reply to this email directly, view it on GitHub > <https://github.com/imzbf/md-editor-v3/issues/147#issuecomment-1206141586>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AI27VJUJKNZSVAZFSKFOFRDVXS775ANCNFSM55S5E23A> > . > You are receiving this because you commented.Message ID: > @.> >
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
很抱歉这么晚才回复
这边尝试了demo,目前操作起来不再有这个问题了,作者不太熟悉tailwindcss
,核对一下是不是版本影响了项目呢~