解决内容为空的问题

This commit is contained in:
yi-ge 2020-07-18 17:46:34 +08:00
parent 9add042253
commit f85dddf4b8
3 changed files with 19 additions and 12 deletions

View File

@ -24,7 +24,7 @@
"koa": "^2.11.0", "koa": "^2.11.0",
"moment": "^2.27.0", "moment": "^2.27.0",
"nuxt": "^2.12.2", "nuxt": "^2.12.2",
"vditor": "^3.3.3", "vditor": "^3.3.8",
"vue-js-modal": "^2.0.0-rc.3", "vue-js-modal": "^2.0.0-rc.3",
"vue-toasted": "^1.1.28" "vue-toasted": "^1.1.28"
}, },

View File

@ -290,7 +290,6 @@ export default {
'export', 'export',
'outline', 'outline',
'preview', 'preview',
'format',
'devtools' 'devtools'
] ]
}], }],
@ -339,7 +338,6 @@ export default {
'export', 'export',
'outline', 'outline',
'preview', 'preview',
'format',
'devtools' 'devtools'
] ]
}], }],
@ -485,6 +483,15 @@ export default {
} }
const editorObj = type === 'editor-reply' ? window.editorReplyObj : window.editorObj const editorObj = type === 'editor-reply' ? window.editorReplyObj : window.editorObj
const content = editorObj.getValue()
if (!content || content === '\n') {
this.$toasted.show('请输入内容', {
position: 'top-center',
duration: 5000
})
return
}
const { data } = await this.$axios({ const { data } = await this.$axios({
method: 'post', method: 'post',
@ -496,7 +503,7 @@ export default {
postID, postID,
lastID, lastID,
parentID, parentID,
content: editorObj.getValue() content
} }
}) })

View File

@ -3105,10 +3105,10 @@ detect-indent@^5.0.0:
resolved "https://mirrors.huaweicloud.com/repository/npm/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" resolved "https://mirrors.huaweicloud.com/repository/npm/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d"
integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50=
diff-match-patch@^1.0.4: diff-match-patch@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37" resolved "https://registry.npm.taobao.org/diff-match-patch/download/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37"
integrity sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw== integrity sha1-q7WE1fEM0Rlt/FWqA3AVkq4/ezc=
diffie-hellman@^5.0.0: diffie-hellman@^5.0.0:
version "5.0.3" version "5.0.3"
@ -8833,12 +8833,12 @@ vary@^1.1.2, vary@~1.1.2:
resolved "https://mirrors.huaweicloud.com/repository/npm/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" resolved "https://mirrors.huaweicloud.com/repository/npm/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
vditor@^3.3.3: vditor@^3.3.8:
version "3.3.3" version "3.3.8"
resolved "https://registry.yarnpkg.com/vditor/-/vditor-3.3.3.tgz#fbab16bf259e060a9502aa8a146943a70cd757f1" resolved "https://registry.npm.taobao.org/vditor/download/vditor-3.3.8.tgz#d60b9c24d7a3e220352c0bbbab158ff5e93e955f"
integrity sha512-Z3rcpW9UWeI3VxQ4K3nNfEN2iC7aflwCVZMTlm2x+X+90EFaOKzgEQEizo+tma+hXcyhhb5UeTnmabVwoDKjNQ== integrity sha1-1gucJNej4iA1LAu7qxWP9ek+lV8=
dependencies: dependencies:
diff-match-patch "^1.0.4" diff-match-patch "^1.0.5"
vendors@^1.0.0: vendors@^1.0.0:
version "1.0.4" version "1.0.4"