Comments (5)
Could you give a reproductive example, such as a GitHub repo or https://codesandbox.io/
from hashmd.
https://codesandbox.io/s/amazing-hugle-hmwhk
from hashmd.
It seems caused by Form.Item
:
https://ant.design/components/form-cn/#API
被设置了 name 属性的 Form.Item 包装的控件,表单控件会自动添加 value(或 valuePropName 指定的其他属性) onChange(或 trigger 指定的其他属性),数据同步将被 Form 接管,这会导致以下结果:
你不再需要也不应该用 onChange 来做数据收集同步(你可以使用 Form 的 onValuesChange),但还是可以继续监听 onChange 事件。
你不能用控件的 value 或 defaultValue 等属性来设置表单域的值,默认值可以用 Form 里的 initialValues 来设置。注意 initialValues 不能被 setState 动态更新,你需要用 setFieldsValue 来更新。
你不应该用 setState,可以使用 form.setFieldsValue 来动态改变表单值。
from hashmd.
OK,then can't be used together.
from hashmd.
其实是可以的,有两种方法
- 去掉
name
,变成不受控组件 - 按照文档里说的设置
initialValues
,不要传undefined
作为value
给Editor
这个错误是因为传了 undefined
过来,导致 CodeMirror 内部调用 split
方法报错了。
from hashmd.
Related Issues (20)
- 中文输入时内容被输入法弹窗遮盖问题 HOT 4
- 编辑器窗口化时会闪屏,放大或缩小页面后没事 HOT 2
- 当我使用它作为流传输回数据展示时候,会出现页面白色闪动问题 HOT 2
- 如何拿到 codemirror 实例? HOT 3
- Editor don't work HOT 2
- WARN: Could not find the language 'mermaid', did you forget to load/include a language module? HOT 2
- 自定义插件里面怎么拿到markdown的原文啊? HOT 2
- how to using bytemd/vue with nuxt2 HOT 2
- [vue3+element plus ui] 在 `el-drawer` 组件中编辑区不显示初始内容
- 希望完善文档,文档太简陋了,编辑器的配置项都没列出来 HOT 4
- 有设置可以实现任何尺寸和mode下,toolbar一直显示吗? HOT 2
- iconfont图标不展示 HOT 2
- Make table of content accessible HOT 1
- Expose ./svelte/icons.js HOT 1
- About highlight.js tree-shaking HOT 1
- Preview write mode
- 能否在点击选项按钮时加上回调
- Is there a function to automatically extract summaries?
- img elements auto adds a paragraph?
- 怎么渲染标签的属性?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashmd.