8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
3.8.3
windows10, macOS15.4.1
在vue3中使用ui-file做文件选择
const invalid = computed(() => !props.data) const scriptInvalid = computed(() => invalid.value || !terminal.value) const scriptValue = computed(() => (scriptInvalid.value ? '' : props.data?.script ?? '')) <ui-file ref="scriptRef" slot="content" :value="scriptValue" :disabled="scriptInvalid" extensions="js,cjs,mjs" :placeholder="getI18n('config_section_script_placeholder')" @confirm="handleScriptConfirm" ></ui-file>
在测试时故意手动输入错误的路径,比如‘c’,会正常出现invalid的黄色框无效状态。 这时外部更新数据,给scriptValue的值是个‘’空字符串,这个组件的invalid无效状态没有消失,必须scriptValue的值是个有效的路径,比如‘\’或‘c:\’,无效的黄框状态消失,然后再设置空字符串才达成原先想直接设置空字符串的数据更新效果。 后来摸索到添加代码
watch( () => props.data, () => { scriptRef.value.value = '\\' } )
由于watch会执行在computed之前,故也达成了设置新的空字符串前先清理无效状态的目的,但这样操作并不优雅。 不知这个现象是个Bug,还是另外有官方正确的使用方式。
No response
如前面描述所示
The text was updated successfully, but these errors were encountered:
你好,很高兴您在使用的过程中把相关的问题反馈给我们,我在收到这个反馈的时候进行了排查,根据上述所描述我进行了复现,并且找到了相关的原因,
Sorry, something went wrong.
yufengctbu
No branches or pull requests
Cocos Creator version
3.8.3
System information
windows10, macOS15.4.1
Issue description
在vue3中使用ui-file做文件选择
在测试时故意手动输入错误的路径,比如‘c’,会正常出现invalid的黄色框无效状态。
这时外部更新数据,给scriptValue的值是个‘’空字符串,这个组件的invalid无效状态没有消失,必须scriptValue的值是个有效的路径,比如‘\’或‘c:\’,无效的黄框状态消失,然后再设置空字符串才达成原先想直接设置空字符串的数据更新效果。
后来摸索到添加代码
由于watch会执行在computed之前,故也达成了设置新的空字符串前先清理无效状态的目的,但这样操作并不优雅。
不知这个现象是个Bug,还是另外有官方正确的使用方式。
Relevant error log output
No response
Steps to reproduce
如前面描述所示
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: