Skip to content

Commit

Permalink
fix: 修复第一次打开可能导致的报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 2, 2023
1 parent 6d1f0c9 commit b05894e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion siyuan/topbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class Topbar {
const dynJsonCfg = setting[DYNAMIC_CONFIG_KEY] as any
this.logger.info("dynJsonCfg =>", dynJsonCfg.totalCfg)
// 构造发布菜单
dynJsonCfg.totalCfg.forEach((config: any) => {
dynJsonCfg.totalCfg?.forEach((config: any) => {
let icon = `<span class="iconfont-icon">${config.platformIcon}</span>`
// 修复图片不展示问题
if (/^\<img/.test(config.platformIcon) && config.platformIcon.indexOf("./images") > -1) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/publish/form/PublishPlatform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (emit) {
const handleCheck = (key: string) => {
if (formData.selectedKeys.includes(key)) {
// 如果 formData.selectedKeys 数组中包含 key,则从数组中删除 key
formData.selectedKeys = formData.selectedKeys.filter((item: string) => item !== key)
formData.selectedKeys = formData.selectedKeys?.filter((item: string) => item !== key)??[]
} else {
// 如果 formData.selectedKeys 数组中不包含 key,则将其添加到数组中
formData.selectedKeys.push(key)
Expand All @@ -80,7 +80,7 @@ onMounted(async () => {
const setting = await getSetting()
const dynJsonCfg = JsonUtil.safeParse<DynamicJsonCfg>(setting[DYNAMIC_CONFIG_KEY], {} as DynamicJsonCfg)
// 过滤出已启用并且配置可用的平台
const enabledConfigs = dynJsonCfg?.totalCfg.filter(
const enabledConfigs = dynJsonCfg.totalCfg?.filter(
(config: DynamicConfig) => config.isEnabled === true && config.isAuth === true
)
// 默认展示通用平台
Expand Down

0 comments on commit b05894e

Please sign in to comment.