🐛 [Bug]: 区块中无法调用工具类的方法
Closed this issue · 7 comments
Bot detected the issue body's language is not English, translate it automatically.
Title: 🐛 [Bug]: The method of the tool class cannot be called in the block
@stwflyfox 你好,可以描述一下当前这个问题具体是在什么环境下复现吗,如:
- 是连接mockServer的本地mock环境,还是连接到我们后端service,有真实的请求?
- 当前调用工具类区块的schema关键内容是否能提供?
Bot detected the issue body's language is not English, translate it automatically.
@stwflyfox Hello, can you describe the specific environment in which this problem occurs? For example: is it connected to the local mock environment of mockServer, or is it connected to our service?
@stwflyfox 你好,可以描述一下当前这个问题具体是在什么环境下复现吗,如:
- 是连接mockServer的本地mock环境,还是连接到我们后端service,有真实的请求?
- 当前调用工具类区块的schema关键内容是否能提供?
是连接到后端service, 在页面中是可以调用工具类的,但在区块中不行, 是在区块的 OnMounted中调用的。区块的 schema 如下:
{
"state": {
"from": "",
"LoginInfo": ""
},
"methods": {
"onButtonClick": {
"type": "JSFunction",
"value": "function onButtonClick(event) {\n console.log('selectProduct onButtonClick', event)\n debugger\n if (event.fun == 'onConfirm') {\n emit('confirm')\n } else if (event.fun == 'onExit') {\n emit('exit')\n }\n}"
}
},
"componentName": "Block",
"fileName": "SelectProduct",
"css": "",
"props": {},
"children": [
{
"componentName": "div",
"props": {
"style": "position: absolute;\ntop: 0px;\nleft: 0px;\nright: 0px;\nbottom: 0px;\n"
},
"id": "29442496",
"children": [
{
"componentName": "Program",
"props": {
"ref": "program",
"size": "mini",
"ProgramCode": "SelectProduct",
"onButtonClick": {
"type": "JSExpression",
"value": "this.onButtonClick"
}
},
"id": "c631462f"
}
]
}
],
"schema": {
"properties": [
{
"label": {
"zh_CN": "基础信息"
},
"description": {
"zh_CN": "基础信息"
},
"collapse": {
"number": 6,
"text": {
"zh_CN": "显示更多"
}
},
"content": [
{
"property": "from",
"type": "string",
"defaultValue": "",
"label": {
"text": {
"zh_CN": "调用来源"
}
},
"cols": 12,
"rules": [],
"accessor": {},
"hidden": false,
"required": true,
"readOnly": false,
"disabled": false,
"widget": {
"component": "MetaInput",
"props": {}
},
"properties": [
{
"label": {
"zh_CN": "默认分组"
},
"content": []
}
]
},
{
"property": "SupID",
"type": "string",
"defaultValue": "",
"label": {
"text": {
"zh_CN": "供应商ID"
}
},
"cols": 12,
"rules": [],
"accessor": {},
"hidden": false,
"required": true,
"readOnly": false,
"disabled": false,
"widget": {
"component": "MetaInput",
"props": {}
},
"properties": [
{
"label": {
"zh_CN": "默认分组"
},
"content": []
}
]
}
]
}
],
"events": {
"onConfirm": {
"label": {
"zh_CN": ""
},
"description": {
"zh_CN": "确认事件"
}
},
"onExit": {
"label": {
"zh_CN": ""
},
"description": {
"zh_CN": "退出事件"
}
}
},
"slots": {}
},
"dataSource": {},
"dependencies": {
"scripts": [
{
"package": "shqy-components",
"version": "",
"script": "https://unpkg.91zd.cn/@shqy/components",
"css": "https://unpkg.91zd.cn/@shqy/components/style.css",
"components": {
"Program": "ProgramBuild"
}
}
],
"styles": [
"https://unpkg.91zd.cn/@shqy/components/style.css"
]
},
"lifeCycles": {
"onMounted": {
"type": "JSFunction",
"value": "function onMounted() {\r\n debugger\r\n\r\n console.log('SelectProduct onMounted', this)\r\n console.log(this.props['from'])\r\n var LoginInfo = this.utils.getLoginInfo();\r\n\r\n} "
}
}
}
@stwflyfox hi,这个问题在这个pr中得到解决, 可以拉一下我们后端最新代码
更新 tiny-engine-webservice 后,这个问题已修复。
Bot detected the issue body's language is not English, translate it automatically.
This issue has been fixed after updating tiny-engine-webservice.