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: { ID: {
type: 'ID', type: 'ID',
text: 'ID 型' text: 'ID 型'
},
ID_SLUG: {
type: 'ID_SLUG',
text: 'ID 别名型'
} }
} }
export default postApi export default postApi

View File

@ -442,6 +442,8 @@ export default {
)}${this.selectedPost.slug ? this.selectedPost.slug : '{slug}'}${pathSuffix}` )}${this.selectedPost.slug ? this.selectedPost.slug : '{slug}'}${pathSuffix}`
case 'ID': case 'ID':
return `${blogUrl}/?p=${this.selectedPost.id ? this.selectedPost.id : '{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: default:
return '' 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 === '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 === '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'">{{ 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> </template>
<a-select v-model="options.post_permalink_type"> <a-select v-model="options.post_permalink_type">
<a-select-option <a-select-option
@ -93,16 +94,16 @@ export default {
props: { props: {
options: { options: {
type: Object, type: Object,
required: true required: true,
}, },
saving: { saving: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
errored: { errored: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
data() { data() {
return { return {
@ -111,25 +112,25 @@ export default {
xl: { span: 8 }, xl: { span: 8 },
lg: { span: 8 }, lg: { span: 8 },
sm: { span: 12 }, sm: { span: 12 },
xs: { span: 24 } xs: { span: 24 },
}, },
rules: {} rules: {},
} }
}, },
watch: { watch: {
options(val) { options(val) {
this.$emit('onChange', val) this.$emit('onChange', val)
} },
}, },
methods: { methods: {
handleSaveOptions() { handleSaveOptions() {
const _this = this const _this = this
_this.$refs.permalinkOptionsForm.validate(valid => { _this.$refs.permalinkOptionsForm.validate((valid) => {
if (valid) { if (valid) {
this.$emit('onSave') this.$emit('onSave')
} }
}) })
} },
} },
} }
</script> </script>