Skip to content

Commit

Permalink
fix:组件属性绑定工具类utils,修改预览出码实现 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyun8 committed Nov 28, 2023
1 parent 6a4de49 commit a6232e5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion mockServer/src/mock/get/app-center/v1/apps/schema/918.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion mockServer/src/services/appinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ export default () => {

const stores = useStores()

return { t: i18n.global.t, stores, lowcodeWrap, utils }
return { t: i18n.global.t, stores, lowcodeWrap }
}
6 changes: 5 additions & 1 deletion packages/vue-generator/src/generator/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit a6232e5

Please sign in to comment.