提交 1402eaa4 编写于 作者: fxy060608's avatar fxy060608

fix(mp): hyphenate component name (easycom)

上级 c783b25d
...@@ -209,7 +209,7 @@ function handleViewEvents (events) { ...@@ -209,7 +209,7 @@ function handleViewEvents (events) {
function genVModel (el, isScopedSlot) { function genVModel (el, isScopedSlot) {
if (el.model) { if (el.model) {
el.model.value = createGenVar(el.attrsMap[ID], isScopedSlot)('v-model', el.model.value) 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)}` el.model.callback = `function($$v){$handleVModelEvent(${el.attrsMap[ID]},$$v)}`
} else { } else {
el.model.callback = `function(){}` el.model.callback = `function(){}`
......
const path = require('path') const path = require('path')
const { const {
hyphenate,
isComponent isComponent
} = require('./util') } = require('./util')
...@@ -44,7 +45,8 @@ function updateMPUsingAutoImportComponents (autoComponents, options) { ...@@ -44,7 +45,8 @@ function updateMPUsingAutoImportComponents (autoComponents, options) {
name, name,
source source
}) => { }) => {
usingAutoImportComponents[name] = '/' + formatSource(source) // 自定义组件统一格式化为 kebab-case
usingAutoImportComponents[hyphenate(name)] = '/' + formatSource(source)
}) })
updateUsingAutoImportComponents(resourcePath, usingAutoImportComponents) // 更新json updateUsingAutoImportComponents(resourcePath, usingAutoImportComponents) // 更新json
} }
......
...@@ -59,7 +59,7 @@ function addVueId (path, state) { ...@@ -59,7 +59,7 @@ function addVueId (path, state) {
state.options.$vueId = 1 state.options.$vueId = 1
} }
const hashId = state.options.hashId const hashId = state.options.hashId
const vueId = String((hashId ? (hashId + '-') : '') + (state.options.$vueId++)) const vueId = (hashId ? (hashId + '-') : '') + (state.options.$vueId++)
let value let value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册