diff --git a/packages/uni-template-compiler/lib/app/view.js b/packages/uni-template-compiler/lib/app/view.js index 2d99b5bc523b44d8ebc400b44ea9f1bef2882474..46242f9206d9b4db36ea93cc9408398eec7c041d 100644 --- a/packages/uni-template-compiler/lib/app/view.js +++ b/packages/uni-template-compiler/lib/app/view.js @@ -209,7 +209,7 @@ function handleViewEvents (events) { function genVModel (el, isScopedSlot) { if (el.model) { el.model.value = createGenVar(el.attrsMap[ID], isScopedSlot)('v-model', el.model.value) - if (el.tag === 'v-uni-input' || el.tag === 'v-uni-textarea' && !(el.events && el.events.input)) { + if ((el.tag === 'v-uni-input' || el.tag === 'v-uni-textarea') && !(el.events && el.events.input)) { el.model.callback = `function($$v){$handleVModelEvent(${el.attrsMap[ID]},$$v)}` } else { el.model.callback = `function(){}` diff --git a/packages/uni-template-compiler/lib/auto-components.js b/packages/uni-template-compiler/lib/auto-components.js index cc9966cd82959f64c9f5cf860aa2af6e34e7f77e..e01d111f6164610d93a461f1903bfc5d9d871f59 100644 --- a/packages/uni-template-compiler/lib/auto-components.js +++ b/packages/uni-template-compiler/lib/auto-components.js @@ -1,6 +1,7 @@ const path = require('path') const { + hyphenate, isComponent } = require('./util') @@ -44,7 +45,8 @@ function updateMPUsingAutoImportComponents (autoComponents, options) { name, source }) => { - usingAutoImportComponents[name] = '/' + formatSource(source) + // 自定义组件统一格式化为 kebab-case + usingAutoImportComponents[hyphenate(name)] = '/' + formatSource(source) }) updateUsingAutoImportComponents(resourcePath, usingAutoImportComponents) // 更新json } diff --git a/packages/uni-template-compiler/lib/script/traverse/visitor.js b/packages/uni-template-compiler/lib/script/traverse/visitor.js index f7bbb7c12beb23a36be7bec33055d85591cb14a2..6da1f3fc75c7d4bb6c2d4a9ff1052d17e070d4f7 100644 --- a/packages/uni-template-compiler/lib/script/traverse/visitor.js +++ b/packages/uni-template-compiler/lib/script/traverse/visitor.js @@ -59,7 +59,7 @@ function addVueId (path, state) { state.options.$vueId = 1 } const hashId = state.options.hashId - const vueId = String((hashId ? (hashId + '-') : '') + (state.options.$vueId++)) + const vueId = (hashId ? (hashId + '-') : '') + (state.options.$vueId++) let value