Ryan Wang 2020-12-01 14:11:15 +08:00 committed by GitHub
parent 558c1e03fc
commit c306b90fb9
3 changed files with 17 additions and 10 deletions

View File

@ -145,6 +145,10 @@ postApi.permalinkType = {
ID: {
type: 'ID',
text: 'ID 型'
},
ID_SLUG: {
type: 'ID_SLUG',
text: 'ID 别名型'
}
}
export default postApi

View File

@ -442,6 +442,8 @@ export default {
)}${this.selectedPost.slug ? this.selectedPost.slug : '{slug}'}${pathSuffix}`
case 'ID':
return `${blogUrl}/?p=${this.selectedPost.id ? this.selectedPost.id : '{id}'}`
case 'ID_SLUG':
return `${blogUrl}/${archivesPrefix}/${this.selectedPost.id ? this.selectedPost.id : '{id}'}${pathSuffix}`
default:
return ''
}

View File

@ -14,6 +14,7 @@
<span v-else-if="options.post_permalink_type === 'DATE'">{{ options.blog_url }}{{ new Date() | moment_post_date }}{slug}{{ options.path_suffix }}</span>
<span v-else-if="options.post_permalink_type === 'DAY'">{{ options.blog_url }}{{ new Date() | moment_post_day }}{slug}{{ options.path_suffix }}</span>
<span v-else-if="options.post_permalink_type === 'ID'">{{ options.blog_url }}/?p={id}</span>
<span v-else-if="options.post_permalink_type === 'ID_SLUG'">{{ options.blog_url }}/{{ options.archives_prefix }}/{id}{{ options.path_suffix }}</span>
</template>
<a-select v-model="options.post_permalink_type">
<a-select-option
@ -93,16 +94,16 @@ export default {
props: {
options: {
type: Object,
required: true
required: true,
},
saving: {
type: Boolean,
default: false
default: false,
},
errored: {
type: Boolean,
default: false
}
default: false,
},
},
data() {
return {
@ -111,25 +112,25 @@ export default {
xl: { span: 8 },
lg: { span: 8 },
sm: { span: 12 },
xs: { span: 24 }
xs: { span: 24 },
},
rules: {}
rules: {},
}
},
watch: {
options(val) {
this.$emit('onChange', val)
}
},
},
methods: {
handleSaveOptions() {
const _this = this
_this.$refs.permalinkOptionsForm.validate(valid => {
_this.$refs.permalinkOptionsForm.validate((valid) => {
if (valid) {
this.$emit('onSave')
}
})
}
}
},
},
}
</script>