Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

perf: optimize the SheetSettingModel component style #471

Merged
merged 1 commit into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/views/sheet/SheetEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</a-row>

<SheetSettingModal
:post="sheetToStage"
:sheet="sheetToStage"
:savedCallback="onSheetSavedCallback"
:visible.sync="sheetSettingVisible"
@onUpdate="onUpdateFromSetting"
Expand Down
2 changes: 1 addition & 1 deletion src/views/sheet/components/CustomSheetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
</div>
<SheetSettingModal
:loading="sheetSettingLoading"
:post="selectedSheet"
:sheet="selectedSheet"
:savedCallback="onSheetSavedCallback"
:visible.sync="sheetSettingVisible"
@onClose="selectedSheet = {}"
Expand Down
39 changes: 19 additions & 20 deletions src/views/sheet/components/SheetSettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,20 @@
</a-select>
</a-form-item>
<a-form-item label="封面图:">
<div class="post-thumb">
<a-space direction="vertical">
<img
:src="form.model.thumbnail || '/images/placeholder.jpg'"
alt="Post cover thumbnail"
class="img"
@click="attachmentSelectVisible = true"
/>
<a-input
v-model="form.model.thumbnail"
allow-clear
placeholder="点击封面图选择图片,或者输入外部链接"
></a-input>
</a-space>
</div>
<a-space direction="vertical">
<img
:src="form.model.thumbnail || '/images/placeholder.jpg'"
alt="Sheet cover thumbnail"
class="w-1/2 cursor-pointer"
style="border-radius: 4px"
@click="attachmentSelectVisible = true"
/>
<a-input
v-model="form.model.thumbnail"
allow-clear
placeholder="点击封面图选择图片,或者输入外部链接"
></a-input>
</a-space>
</a-form-item>
</a-form>
</a-tab-pane>
Expand Down Expand Up @@ -113,7 +112,6 @@
</div>
<template slot="footer">
<slot name="extraFooter" />
<a-button :disabled="loading" @click="modalVisible = false"> 关闭</a-button>
<ReactiveButton
v-if="!form.model.id"
:errored="form.draftSaveErrored"
Expand All @@ -134,6 +132,7 @@
@callback="handleSavedCallback"
@click="handleCreateOrUpdate()"
></ReactiveButton>
<a-button :disabled="loading" @click="modalVisible = false">关闭</a-button>
</template>
<AttachmentSelectModal
:multiSelect="false"
Expand Down Expand Up @@ -168,7 +167,7 @@ export default {
type: Boolean,
default: false
},
post: {
sheet: {
type: Object,
default: () => ({})
},
Expand Down Expand Up @@ -229,13 +228,13 @@ export default {
watch: {
modalVisible(value) {
if (value) {
this.form.model = Object.assign({}, this.post)
this.form.model = Object.assign({}, this.sheet)
if (!this.form.model.slug && !this.form.model.id) {
this.handleGenerateSlug()
}
}
},
post: {
sheet: {
deep: true,
handler(value) {
this.form.model = Object.assign({}, value)
Expand All @@ -247,7 +246,7 @@ export default {
},
methods: {
/**
* Creates or updates a post
* Creates or updates a sheet
*/
async handleCreateOrUpdate(preStatus = 'PUBLISHED') {
if (!this.form.model.title) {
Expand Down