如何解决单击关闭应用程序时,nextjs 出现未知错误
Unhandled Runtime Error
TypeError: Cannot read property 'getIn' of undefined
Source
.next\static\chunks\pages\about.js (114:0) @ editOnInput
112 | leafKey = _DraftOffsetKey$decod.leafKey;
113 |
> 114 | var _editorState$getBlock = editorState.getBlockTree(blockKey).getIn([decoratorKey,'leaves',leafKey]),115 | start = _editorState$getBlock.start,116 | end = _editorState$getBlock.end;
117 |
Call Stack
HTMLUnkNownElement.callCallback
.next\static\chunks\main.js (3945:0)
invokeGuardedCallback
.next\static\chunks\main.js (4056:0)
executedispatch
.next\static\chunks\main.js (8243:0)
processdispatchQueue
.next\static\chunks\main.js (8288:0)
<unkNown>
.next\static\chunks\main.js (8508:0)
batchedEventUpdates
.next\static\chunks\main.js (3745:0)
attemptTodispatchEvent
.next\static\chunks\main.js (6005:0)
unstable_runWithPriority
.next\static\chunks\main.js (468:0)
discreteUpdates$1
.next\static\chunks\main.js (22413:0)
dispatchdiscreteEvent
.next\static\chunks\main.js (5889:0)
Show collapsed frames
为了测试目的,我构建了 Draftjs 最基本的简单方面,然后它产生了这个错误。
我所做的具体操作是点击富文本编辑器空间。
这是我的代码。
import React,{useState} from 'react'
import Style from "./about.module.css";
import Nav from "../../features/Nav"
import Bin from "../../bin/index"
import { EditorState,Editor,convertToRaw } from 'draft-js';
function About() {
const [draft,setDraft] = useState({
editorState: EditorState.createEmpty()
});
let onChange = (editorState) => {
const contentState = editorState.getCurrentContent();
console.log('content state',convertToRaw(contentState));
setDraft({
editorState,});
}
return (
<div>
<Nav/>
<div>
Hi
<Editor
style={{border:"1px solid black",backgorundColor:"yellow"}}
editorState={draft.editorState}
onChange={onChange}
/>
hi
</div>
</div>
)
}
export default About
我所做的只是 npx create-next-app --example with-redux-toolkit my-app && npm i draftjs(也卡在导航栏中)
然后制作了上述关于页面。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。