diff --git a/src/views/post/components/PostSettingDrawer.vue b/src/views/post/components/PostSettingDrawer.vue index 469295a38..26b164bcd 100644 --- a/src/views/post/components/PostSettingDrawer.vue +++ b/src/views/post/components/PostSettingDrawer.vue @@ -18,7 +18,19 @@ - + + + @@ -387,7 +399,9 @@ export default { this.handleListCategories() this.handleListPresetMetasField() this.handleListCustomTpls() - this.handleSetPinyinSlug() + if (!this.selectedPost.slug && !this.selectedPost.id) { + this.handleSetPinyinSlug() + } } }, handleListCategories() { @@ -534,10 +548,10 @@ export default { }) }, handleSetPinyinSlug() { - if (this.selectedPost.title && this.selectedPost.title !== '' && !this.selectedPost.id) { + if (this.selectedPost.title) { if (pinyin.isSupported()) { let result = '' - const tokens = pinyin.parse(this.selectedPost.title) + const tokens = pinyin.parse(this.selectedPost.title.replace(/\s+/g, '').toLowerCase()) let lastToken tokens.forEach(token => { if (token.type === 2) { diff --git a/src/views/sheet/components/SheetSettingDrawer.vue b/src/views/sheet/components/SheetSettingDrawer.vue index 920583dc5..ea8dc3fc2 100644 --- a/src/views/sheet/components/SheetSettingDrawer.vue +++ b/src/views/sheet/components/SheetSettingDrawer.vue @@ -18,7 +18,19 @@ - + + + { if (token.type === 2) {