Browse Source

调整字体组件的属性编辑

Shinohara Haruna 5 tháng trước cách đây
mục cha
commit
345cb1ce48
1 tập tin đã thay đổi với 12 bổ sung3 xóa
  1. 12 3
      smsb-plus-ui/src/views/smsb/itemProgram/EditProgram.vue

+ 12 - 3
smsb-plus-ui/src/views/smsb/itemProgram/EditProgram.vue

@@ -170,14 +170,18 @@
         </template>
       </div>
       <hr class="property-divider" />
-      <div class="json-debug-title">当前JSON</div>
-      <el-input class="json-debug" type="textarea" :rows="8" :model-value="JSON.stringify(editorContent, null, 2)"
-        readonly />
+      <template v-if="isLocalDev">
+        <div class="json-debug-title">当前JSON</div>
+        <el-input class="json-debug" type="textarea" :rows="8" :model-value="JSON.stringify(editorContent, null, 2)"
+          readonly />
+      </template>
     </div>
   </div>
 </template>
 
 <script setup lang="ts">
+// 本地开发环境开关,正式环境请设为 false 或用 import.meta.env 读取
+const isLocalDev = false;
 // 对齐尺寸操作
 function alignComponent(type: string) {
   if (!selectedComponent.value || selectedComponent.value.type === 'canvas') return;
@@ -317,6 +321,11 @@ function selectCanvasFromSidebar() {
 // 属性栏显示哪些属性可编辑(可根据实际需求过滤)
 function showEditableProp(key: string) {
   // 明确排除 type 字段,防止被编辑
+  if (!selectedComponent.value) return false;
+  // 对于文本和滚动文本组件,移除 'fontWeight' 属性
+  if ((selectedComponent.value.type === 'text' || selectedComponent.value.type === 'scrollingText') && (key === 'fontWeight' || key === 'align')) {
+    return false;
+  }
   return !['type', 'depth'].includes(key);
 }