feat: 前台404页与通配路由; 积木拖拽排序(vuedraggable); nginx SPA说明
Made-with: Cursor
This commit is contained in:
@@ -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('已应用')
|
||||
|
||||
Reference in New Issue
Block a user