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

默认modelId为1会导致在模型只有一个的情况下无法正确加载模型 #135

Open
wuuconix opened this issue Mar 21, 2023 · 0 comments · May be fixed by #136
Open

默认modelId为1会导致在模型只有一个的情况下无法正确加载模型 #135

wuuconix opened this issue Mar 21, 2023 · 0 comments · May be fixed by #136

Comments

@wuuconix
Copy link

问题代码:

modelId = 1; // 模型 ID

本项目默认加载modelId为1的模型。
当使用cdn方式加载模型时,modelId将作为数组下标。
const target = randomSelection(this.modelList.models[modelId]);

而当cdn中只有一个模型时,this.modelList.models 这个数组将只存在一个元素,即下标为0的那个元素
而默认modelId默认为1,故this.modelList.models[1]将返回undefined。
这最终导致target这个原本应该是模型名称的变量成为undefined。

image

复现页面:
https://codepen.io/wuuconix/pen/RwYeKPm
将默认modelId设置为0后的效果:
https://codepen.io/wuuconix/pen/abaRpEQ

@wuuconix wuuconix linked a pull request Mar 21, 2023 that will close this issue
@stevenjoezhang stevenjoezhang linked a pull request Apr 3, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant