2018-10-02 04:42:53 +08:00
|
|
|
import { TestElement, logNodeOp, NodeOpTypes } from './nodeOps'
|
2018-10-29 05:43:27 +08:00
|
|
|
import { isOn } from '@vue/shared'
|
2018-10-02 04:42:53 +08:00
|
|
|
|
|
|
|
export function patchData(
|
|
|
|
el: TestElement,
|
|
|
|
key: string,
|
|
|
|
prevValue: any,
|
|
|
|
nextValue: any
|
|
|
|
) {
|
|
|
|
logNodeOp({
|
|
|
|
type: NodeOpTypes.PATCH,
|
|
|
|
targetNode: el,
|
|
|
|
propKey: key,
|
|
|
|
propPrevValue: prevValue,
|
|
|
|
propNextValue: nextValue
|
|
|
|
})
|
|
|
|
el.props[key] = nextValue
|
2018-10-29 05:43:27 +08:00
|
|
|
if (isOn(key)) {
|
|
|
|
const event = key.slice(2).toLowerCase()
|
|
|
|
;(el.eventListeners || (el.eventListeners = {}))[event] = nextValue
|
|
|
|
}
|
2018-10-02 04:42:53 +08:00
|
|
|
}
|