feat: 前台404页与通配路由; 积木拖拽排序(vuedraggable); nginx SPA说明

Made-with: Cursor
This commit is contained in:
whm
2026-03-19 17:11:16 +08:00
parent 88f9d42f91
commit e1fc257435
10 changed files with 196 additions and 27 deletions

View File

@@ -30,7 +30,12 @@ const blocks = ref([])
const jsonDraft = ref('')
let syncingFromParent = false
function newBlockId() {
return 'b-' + Date.now() + '-' + Math.random().toString(36).slice(2, 10)
}
function normalizeBlock(b) {
if (!b.id) b.id = newBlockId()
if (!b.props) b.props = {}
if (!b.animation) b.animation = { enter: 'fadeIn', delay_ms: 0, duration_ms: 600 }
if (b.type === 'link_list' && !Array.isArray(b.props.items)) b.props.items = []
@@ -86,6 +91,7 @@ function applyJsonDraft() {
}
syncingFromParent = true
blocks.value = JSON.parse(JSON.stringify(j.blocks))
blocks.value.forEach(normalizeBlock)
syncingFromParent = false
emit('update:modelValue', stringify())
ElMessage.success('已应用')