diff --git a/src/utils/index.js b/src/utils/index.js index 285cd19a..431fda2d 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -261,3 +261,7 @@ export function deepClone(source) { }) return targetObj } + +export function uniqueArr(arr) { + return Array.from(new Set(arr)) +} diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index f25f7e9e..8528db44 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -3,48 +3,9 @@ - - - {{!postForm.comment_disabled?'评论已打开':'评论已关闭'}} - - - - - - 关闭评论 - 打开评论 - - - - - - - 平台 - - - - - - {{item.name}} - - - - - - - - 外链 - - - - - - - - - - - + + + 发布 草稿 @@ -52,9 +13,9 @@
-

- 创建和编辑页面是不能被keep-alive缓存的,因为keep-alive目前不支持根据路由来缓存,所以目前都是基于component name来缓存的,如果你想要实现缓存的效果,可以使用localstorage等游览器缓存方案。或者不要使用keep-alive 的include,直接缓存所有页面。 -

+ + + @@ -67,12 +28,19 @@ + + + + - - - -
@@ -99,11 +60,11 @@
- +
- +
@@ -121,6 +82,8 @@ import Sticky from '@/components/Sticky' // 粘性header组件 import { validateURL } from '@/utils/validate' import { fetchArticle } from '@/api/article' import { userSearch } from '@/api/remoteSearch' +import Warning from './Warning' +import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown' const defaultForm = { status: 'draft', @@ -138,7 +101,7 @@ const defaultForm = { export default { name: 'articleDetail', - components: { Tinymce, MDinput, Upload, Multiselect, Sticky }, + components: { Tinymce, MDinput, Upload, Multiselect, Sticky, Warning, CommentDropdown, PlatformDropdown, SourceUrlDropdown }, props: { isEdit: { type: Boolean, @@ -176,11 +139,6 @@ export default { postForm: Object.assign({}, defaultForm), loading: false, userListOptions: [], - platformsOptions: [ - { key: 'a-platform', name: 'a-platform' }, - { key: 'b-platform', name: 'b-platform' }, - { key: 'c-platform', name: 'c-platform' } - ], rules: { image_uri: [{ validator: validateRequire }], title: [{ validator: validateRequire }], @@ -252,7 +210,6 @@ export default { getRemoteUserList(query) { userSearch(query).then(response => { if (!response.data.items) return - console.log(response) this.userListOptions = response.data.items.map(v => v.name) }) } @@ -261,43 +218,36 @@ export default { diff --git a/src/views/example/components/Dropdown/Comment.vue b/src/views/example/components/Dropdown/Comment.vue new file mode 100644 index 00000000..da217599 --- /dev/null +++ b/src/views/example/components/Dropdown/Comment.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/example/components/Dropdown/Platform.vue b/src/views/example/components/Dropdown/Platform.vue new file mode 100644 index 00000000..a20321dd --- /dev/null +++ b/src/views/example/components/Dropdown/Platform.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/views/example/components/Dropdown/SourceUrl.vue b/src/views/example/components/Dropdown/SourceUrl.vue new file mode 100644 index 00000000..f09eb69d --- /dev/null +++ b/src/views/example/components/Dropdown/SourceUrl.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/example/components/Dropdown/index.js b/src/views/example/components/Dropdown/index.js new file mode 100644 index 00000000..bc0c171b --- /dev/null +++ b/src/views/example/components/Dropdown/index.js @@ -0,0 +1,3 @@ +export { default as CommentDropdown } from './Comment' +export { default as PlatformDropdown } from './Platform' +export { default as SourceUrlDropdown } from './SourceUrl' diff --git a/src/views/example/components/Warning.vue b/src/views/example/components/Warning.vue new file mode 100644 index 00000000..a0012ede --- /dev/null +++ b/src/views/example/components/Warning.vue @@ -0,0 +1,9 @@ + +