Jelajahi Sumber

fix: 修复系统组件,如果没有配置封面图片的时候,出现组件列表不显示,并控制台出错的问题

wu.jian2 1 tahun lalu
induk
melakukan
865af9120a

+ 12 - 2
data-room-ui/packages/RemoteComponents/remoteComponentsList.js

@@ -8,8 +8,18 @@ const innerRemoteComponents = []
 
 files.keys().forEach(key => {
   const title = key.split('/')[1].replace('.vue', '')
-  const img = require(`./innerComponents/${title}/component.png`)
-  const config = require(`./innerComponents/${title}/config.js`).default
+  let img = null
+  let config = {}
+  try {
+    img = require(`./innerComponents/${title}/component.png`)
+  } catch (error) {
+    console.log(error)
+  }
+  try {
+    config = require(`./innerComponents/${title}/config.js`).default
+  } catch (error) {
+
+  }
   innerRemoteComponents.push({
     title: config.title || title,
     vueSysComponentDirName: 'inner_' + title,