From d29e01d55283b27fbc5c716a7652d7bc68c5ea64 Mon Sep 17 00:00:00 2001 From: Misitebao Date: Tue, 8 Mar 2022 03:54:40 +0800 Subject: [PATCH] docs: sync documents (#1224) --- .../current/guides/troubleshooting.mdx | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx index 0b0bd81ea..f10e73e49 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -22,3 +22,44 @@ var assets embed.FS

您的应用程序的 `info.plist` 可能无效。更新 `build/.app/Contents/info.plist` 文件并检查数据是否有效,例如二进制文件名称是否正确。要保留更改,请将文件复制回 `build/darwin` 目录。 + +## 前端调用后端方法无法使用可变参数 + +如果您有使用可变参数定义的后端方法,例如: + +```go +func (a *App) TestFunc(msg string, args ...interface{}) error { + // Code +} +``` + +像这样从前端调用此方法将失败: + +```js +var msg = "Hello: "; +var args = ["Go", "JS"]; +window.go.main.App.TestFunc(msg, ...args) + .then((result) => { + //do things here + }) + .catch((error) => { + //handle error + }); +``` + +解决办法: + +```js +var msg = "Hello "; +var args = ["Go", "JS"]; +window.go.main.App.TestFunc(msg, args) + .then((result) => { + // 不需要展开符 + // do things here + }) + .catch((error) => { + //handle error + }); +``` + +勋章:https://github.com/wailsapp/wails/issues/1186