Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: 区块中无法调用工具类的方法 #323

Closed
stwflyfox opened this issue Mar 8, 2024 · 7 comments
Closed

🐛 [Bug]: 区块中无法调用工具类的方法 #323

stwflyfox opened this issue Mar 8, 2024 · 7 comments
Assignees

Comments

@stwflyfox
Copy link
Contributor

Environment

chrome

Version

latest

Version

latest

Link to minimal reproduction

区块中无法调用工具类的方法

Step to reproduce

在页面中可调用的工具类方法,在区块中都无法调用。
1709884798942
1709884743595

What is expected

No response

What is actually happening

No response

Any additional comments (optional)

No response

@Issues-translate-bot
Copy link

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

@wenmine
Copy link
Collaborator

wenmine commented Mar 16, 2024

@stwflyfox 你好,可以描述一下当前这个问题具体是在什么环境下复现吗,如:

  1. 是连接mockServer的本地mock环境,还是连接到我们后端service,有真实的请求?
  2. 当前调用工具类区块的schema关键内容是否能提供?

@Issues-translate-bot
Copy link

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
Copy link
Contributor Author

@stwflyfox 你好,可以描述一下当前这个问题具体是在什么环境下复现吗,如:

  1. 是连接mockServer的本地mock环境,还是连接到我们后端service,有真实的请求?
  2. 当前调用工具类区块的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} "
    }
    }
    }

@wenmine
Copy link
Collaborator

wenmine commented Mar 20, 2024

@stwflyfox hi,这个问题在这个pr中得到解决, 可以拉一下我们后端最新代码

@stwflyfox
Copy link
Contributor Author

更新 tiny-engine-webservice 后,这个问题已修复。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This issue has been fixed after updating tiny-engine-webservice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants