重绘时输入值未更新
Input value not updated on redraw
正如您在测试中看到的那样,当视图重绘时,"p" 内容会更新,但不会更新与源具有相同数据流的输入值。为什么?
var root = document.body
let v = m.stream({
field: m.stream()
})
var Hello = {
view: function() {
return m("main", [
m("input", {
value: v().field(),
oninput: m.withAttr('value', v().field)
}),
m(
'p', [
v().field()
]
),
m(
"button", {
"type": "button",
onclick: function() {
v({
field: m.stream()
})
}
}, [
'save'
]
),
m('div', ['Write on input then click save. After click save the P content disappear but input value still. why?'])
])
}
}
m.mount(root, Hello)
<script src="https://unpkg.com/mithril/mithril.js"></script>
<script src="https://unpkg.com/mithril-stream"></script>
Bug。在非常友善的秘银员工的帮助下修复
正如您在测试中看到的那样,当视图重绘时,"p" 内容会更新,但不会更新与源具有相同数据流的输入值。为什么?
var root = document.body
let v = m.stream({
field: m.stream()
})
var Hello = {
view: function() {
return m("main", [
m("input", {
value: v().field(),
oninput: m.withAttr('value', v().field)
}),
m(
'p', [
v().field()
]
),
m(
"button", {
"type": "button",
onclick: function() {
v({
field: m.stream()
})
}
}, [
'save'
]
),
m('div', ['Write on input then click save. After click save the P content disappear but input value still. why?'])
])
}
}
m.mount(root, Hello)
<script src="https://unpkg.com/mithril/mithril.js"></script>
<script src="https://unpkg.com/mithril-stream"></script>
Bug。在非常友善的秘银员工的帮助下修复