feat: 页面配置默认模板增加编辑按钮
This commit is contained in:
@@ -9,7 +9,10 @@
|
|||||||
<div v-for="dt in defaults" :key="dt.type" style="border:1px solid #ebeef5;border-radius:4px;padding:10px 14px;min-width:200px">
|
<div v-for="dt in defaults" :key="dt.type" style="border:1px solid #ebeef5;border-radius:4px;padding:10px 14px;min-width:200px">
|
||||||
<div style="font-weight:500;margin-bottom:6px">{{ dt.label }} <el-tag size="small">{{ dt.type }}</el-tag></div>
|
<div style="font-weight:500;margin-bottom:6px">{{ dt.label }} <el-tag size="small">{{ dt.type }}</el-tag></div>
|
||||||
<div style="font-size:12px;color:#909399;margin-bottom:8px">{{ dt.entries.length }} 个入口</div>
|
<div style="font-size:12px;color:#909399;margin-bottom:8px">{{ dt.entries.length }} 个入口</div>
|
||||||
<el-button size="small" @click="previewDefault(dt)">查看模板</el-button>
|
<div style="display:flex;gap:4px">
|
||||||
|
<el-button size="small" @click="previewDefault(dt)">查看</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="editDefault(dt)">编辑默认</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -154,8 +157,16 @@ const loadDefault = (row) => {
|
|||||||
window.scrollTo({top: document.body.scrollHeight, behavior:'smooth'})
|
window.scrollTo({top: document.body.scrollHeight, behavior:'smooth'})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const editDefault = (dt) => {
|
||||||
|
editSiteId.value = dt.type
|
||||||
|
editingEntries.value = JSON.parse(JSON.stringify(dt.entries))
|
||||||
|
if (editingEntries.value.length === 0) editingEntries.value.push({key:'home',label:'首页',url:'{base}',method:'GET'})
|
||||||
|
editorMode.value = 'table'
|
||||||
|
window.scrollTo({top: document.body.scrollHeight, behavior:'smooth'})
|
||||||
|
}
|
||||||
|
|
||||||
const previewDefault = (dt) => {
|
const previewDefault = (dt) => {
|
||||||
ElMessageBox.alert(JSON.stringify(dt.entries, null, 2), dt.type + ' 默认模板', { dangerouslyUseHTMLString: false })
|
ElMessageBox.alert(JSON.stringify(dt.entries, null, 2), dt.type + ' 默认模板')
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleEdit = (row) => {
|
const toggleEdit = (row) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user