修复编辑模式进入组件报错的问题

This commit is contained in:
2025-06-13 17:06:52 +08:00
parent e14068f507
commit e369ebe87b
3 changed files with 3 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "material-editor", "name": "material-editor",
"private": true, "private": true,
"version": "1.0.29", "version": "1.0.30",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -205,7 +205,7 @@ const materialInfo = reactive({
}); });
watch(Textures, async (val) => { watch(Textures, async (val) => {
if (val.length == 0) return; if (val.length == 0 || props.ignoreTexture) return;
await scene.ChangeTextureFromUrlAsync(val[0].src); await scene.ChangeTextureFromUrlAsync(val[0].src);
}); });

View File

@@ -56,7 +56,7 @@ async function HandleUpdateConfig() {
editMode.value = true; editMode.value = true;
} }
else { editMode.value = false; } else { editMode.value = false; }
if (config.textures) { if (config.textures && config.textures.length > 0) {
textures.value = Array.from(config.textures); textures.value = Array.from(config.textures);
await scene.ChangeTextureFromUrlAsync(textures.value[0].src); // 这一行是保证首次Mount组件时纹理能够立刻刷新 await scene.ChangeTextureFromUrlAsync(textures.value[0].src); // 这一行是保证首次Mount组件时纹理能够立刻刷新
} }