Closed dvien closed 2 years ago
src/page/template/template-transformer.js transformEvent处理bind:与capture-bind:及catch:与capture-catch:存在冲突,匹配短的先执行,会导致capture-被替换成错误标签
function transformEvent(keyNode, valueNode, state) { // name, value, attribs,state var name = keyNode.content
let event = name if (name.indexOf('bind') === 0) { event = transformEventName(name.replace(bindRE, ''), state) } else if (name.indexOf('catch') === 0) { event = transformEventName(name.replace(catchRE, ''), state) + '.stop.prevent' } else if (name.indexOf('capture-bind') === 0) { event = transformEventName(name.replace(captureBindRE, ''), state) + '.capture' } else if (name.indexOf('capture-catch') === 0) { event = transformEventName(name.replace(captureCatchRE, ''), state) + '.stop.prevent.capture' }
let event = name if (name.indexOf('capture-bind') === 0) { event = transformEventName(name.replace(captureBindRE, ''), state) + '.capture' } else if (name.indexOf('bind') === 0) { event = transformEventName(name.replace(bindRE, ''), state) } else if (name.indexOf('capture-catch') === 0) { event = transformEventName(name.replace(captureCatchRE, ''), state) + '.stop.prevent.capture' } else if (name.indexOf('catch') === 0) { event = transformEventName(name.replace(catchRE, ''), state) + '.stop.prevent' }
问题描述?
src/page/template/template-transformer.js transformEvent处理bind:与capture-bind:及catch:与capture-catch:存在冲突,匹配短的先执行,会导致capture-被替换成错误标签
重现步骤
function transformEvent(keyNode, valueNode, state) { // name, value, attribs,state var name = keyNode.content
期望的结果
function transformEvent(keyNode, valueNode, state) { // name, value, attribs,state var name = keyNode.content