Skip to content

Commit

Permalink
optimize: Deal with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
STATICHIT committed Aug 28, 2024
1 parent 01dcffd commit e6e7a9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions packages/controller/src/useLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default () => {

//获取某个布局(左上/左下/右上)的插件名称列表
const getPluginLayout = (layout) => {
const targetLayout = []
const targetLayout = layout ? [] : null
// 遍历对象并将 align 值分类到不同的数组中
for (const key in pluginStorageReactive.value) {
if (pluginStorageReactive.value[key].align === layout || layout === 'all') {
Expand All @@ -185,7 +185,9 @@ export default () => {

//修改某个插件的布局
const changePluginLayout = (name, layout) => {
pluginStorageReactive.value[name].align = layout
if (pluginStorageReactive.value[name]) {
pluginStorageReactive.value[name].align = layout
}
}

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/design-core/config/addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ addons.settings.forEach((item) => {
})

export const getPlugin = (pluginName) => {
return plugin[pluginName]
return plugin[pluginName] || null
}

export default addons
8 changes: 6 additions & 2 deletions packages/design-core/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ export default {
const plugin = {}
addons.plugins.forEach((item) => {
plugin[item.id] = { width: item.options?.width || 300, align: item.options?.align || 'leftTop' }
if (item.id) {
plugin[item.id] = { width: item.options?.width || 300, align: item.options?.align || 'leftTop' }
}
})
addons.settings.forEach((item) => {
plugin[item.id] = { width: item.options?.width || 320, align: item.options?.align || 'leftTop' }
if (item.id) {
plugin[item.id] = { width: item.options?.width || 320, align: item.options?.align || 'leftTop' }
}
})
localStorage.setItem('plugin', JSON.stringify(plugin))
Expand Down

0 comments on commit e6e7a9d

Please sign in to comment.