fix:组件属性绑定工具类utils,修改预览出码实现 (#93)

This commit is contained in:
yaoyun8 2023-11-28 11:14:25 +08:00 committed by GitHub
parent 6a4de499a4
commit a6232e5c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 5 deletions

View File

@ -102,7 +102,7 @@
"type": "function",
"content": {
"type": "JSFunction",
"value": "function util() {\r\n console.log(3211)\r\n}"
"value": "function test() {\r\n return 'test'\r\n}"
},
"app": 918,
"category": "utils",

View File

@ -1404,7 +1404,7 @@
"type": "function",
"content": {
"type": "JSFunction",
"value": "function util() {\r\n console.log(3211)\r\n}"
"value": "function test() {\r\n return 'test'\r\n}"
}
},
{

View File

@ -1057,7 +1057,7 @@
"type": "function",
"content": {
"type": "JSFunction",
"value": "function util() {\r\n console.log(3211)\r\n}"
"value": "function test() {\r\n return 'test'\r\n}"
},
"app": 918,
"category": "utils",

View File

@ -88,5 +88,5 @@ export default () => {
const stores = useStores()
return { t: i18n.global.t, stores, lowcodeWrap, utils }
return { t: i18n.global.t, stores, lowcodeWrap }
}

View File

@ -41,6 +41,10 @@ function recurseChildren(children, state, description, result) {
result.push(subTemplate)
} else if (children?.type === 'JSExpression') {
result.push(`{{ ${children.value.replace(/this\.(props\.)?/g, '')} }}`)
for (const key in description.jsResource) {
description.jsResource[key] = description.jsResource[key] || children.value.includes(`.${key}.`)
}
} else if (children?.type === 'i18n') {
result.push(`{{ t('${children.key}') }}`)
} else {
@ -398,7 +402,7 @@ ${imports.join('\n')}
const props = defineProps({${propsArr.join(',\n')}})
const emit = defineEmits(${JSON.stringify(emitsArr)})
const { t, lowcodeWrap, stores, utils } = vue.inject(I18nInjectionKey).lowcode()
const { t, lowcodeWrap, stores } = vue.inject(I18nInjectionKey).lowcode()
const wrap = lowcodeWrap(props, { emit }, t)
${iconStatement}