diff --git a/packages/hap-compiler/src/template/validator.js b/packages/hap-compiler/src/template/validator.js index 6cf30fe2..a7b27049 100644 --- a/packages/hap-compiler/src/template/validator.js +++ b/packages/hap-compiler/src/template/validator.js @@ -1118,15 +1118,27 @@ function checkTagName(node, output, options = {}) { ) { const locationAddr = location.line && location.column ? '@' + location.line + ':' + location.column : '' - colorconsole.throw( - 'ERROR: ' + - locationAddr + - ' 使用 `' + - tagName + - '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + - tagNatives[tagName].minRequiredRuntimeVersion + - ', 请修改' - ) + if (options.isTargetVivo) { + colorconsole.throw( + 'ERROR: ' + + locationAddr + + ' 使用 `' + + tagName + + '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + + tagNatives[tagName].minRequiredRuntimeVersion + + ', 请修改' + ) + } else { + colorconsole.warn( + 'ERROR: ' + + locationAddr + + ' 使用 `' + + tagName + + '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + + tagNatives[tagName].minRequiredRuntimeVersion + + ', 请修改' + ) + } } // 检测根组件合法性 diff --git a/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js b/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js index ae91e14f..e5265877 100644 --- a/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js +++ b/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js @@ -269,7 +269,7 @@ function makeLoaderString(type, config, newJSCard, uxType) { * @returns {string} */ function processImportFrag($loader, imports, importNames, queryOptions = {}) { - const { newJSCard, lite, cardEntry, minCardRuntimeVersion } = queryOptions + const { newJSCard, lite, cardEntry, minCardRuntimeVersion, isTargetVivo } = queryOptions let retStr = '' if (imports.length) { const newJSCardParam = newJSCard ? `&newJSCard=${newJSCard}` : '' @@ -278,6 +278,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { const minCardRuntimeVersionParam = minCardRuntimeVersion ? `&minCardRuntimeVersion=${minCardRuntimeVersion}` : '' + const isTargetVivoParam = isTargetVivo ? `&isTargetVivo=${isTargetVivo}` : '' for (let i = 0; i < imports.length; i++) { const imp = imports[i] let importSrc = imp.attrs.src @@ -314,7 +315,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { let reqStr = makeRequireString( $loader, makeLoaderString(FRAG_TYPE.IMPORT, null, newJSCard), - `${importSrc}?uxType=${ENTRY_TYPE.COMP}&name=${importName}${newJSCardParam}${liteParam}${cardEntryParam}${minCardRuntimeVersionParam}` + `${importSrc}?uxType=${ENTRY_TYPE.COMP}&name=${importName}${newJSCardParam}${liteParam}${cardEntryParam}${minCardRuntimeVersionParam}${isTargetVivoParam}` ) if (compileOptionsObject.stats) { @@ -338,7 +339,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { * @param {number} lite 轻卡 */ function processTemplateFrag($loader, templates, importNames, queryOptions = {}) { - const { uxType, newJSCard, lite, cardEntry, minCardRuntimeVersion } = queryOptions + const { uxType, newJSCard, lite, cardEntry, minCardRuntimeVersion, isTargetVivo } = queryOptions let retStr = '{}' if (!templates.length) { $loader.emitError(new Error('需要模板