From e0610fdcc0d9ad58b0136a5ed021b7178ef7fa1f Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 15 Sep 2021 21:03:18 +0800 Subject: [PATCH] :bug: fix publish field not required --- docs/.vuepress/components/Adapter.vue | 14 ++++++++++---- docs/.vuepress/components/Bot.vue | 12 ++++++++---- docs/.vuepress/components/Plugin.vue | 14 ++++++++++---- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/docs/.vuepress/components/Adapter.vue b/docs/.vuepress/components/Adapter.vue index a4dc0906..7d7bf7f2 100644 --- a/docs/.vuepress/components/Adapter.vue +++ b/docs/.vuepress/components/Adapter.vue @@ -36,6 +36,7 @@ @@ -43,6 +44,7 @@ @@ -50,6 +52,7 @@ @@ -57,6 +60,7 @@ @@ -64,6 +68,7 @@ @@ -81,10 +86,7 @@ :disabled="!valid" color="blue darken-1" text - @click=" - dialog = false; - publishAdapter(); - " + @click="publishAdapter" > 发布 @@ -148,6 +150,7 @@ export default { page: 1, dialog: false, valid: false, + rules: [(v) => !!v || "This field is required"], newAdapter: { name: null, desc: null, @@ -174,10 +177,13 @@ export default { displayAdapters() { return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10); }, + }, + methods: { publishAdapter() { if (!this.$refs.newAdapterForm.validate()) { return; } + this.dialog = false; const title = encodeURIComponent( `Adapter: ${this.newAdapter.name}` ).replace(/%2B/gi, "+"); diff --git a/docs/.vuepress/components/Bot.vue b/docs/.vuepress/components/Bot.vue index 10b0e303..b2d797d6 100644 --- a/docs/.vuepress/components/Bot.vue +++ b/docs/.vuepress/components/Bot.vue @@ -36,6 +36,7 @@ @@ -43,6 +44,7 @@ @@ -50,6 +52,7 @@ @@ -67,10 +70,7 @@ :disabled="!valid" color="blue darken-1" text - @click=" - dialog = false; - publishBot(); - " + @click="publishBot" > 发布 @@ -128,6 +128,7 @@ export default { page: 1, dialog: false, valid: false, + rules: [(v) => !!v || "This field is required"], newBot: { name: null, desc: null, @@ -151,10 +152,13 @@ export default { displayBots() { return this.filteredBots.slice((this.page - 1) * 10, this.page * 10); }, + }, + methods: { publishBot() { if (!this.$refs.newBotForm.validate()) { return; } + this.dialog = false; const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace( /%2B/gi, "+" diff --git a/docs/.vuepress/components/Plugin.vue b/docs/.vuepress/components/Plugin.vue index a938a59e..771e0705 100644 --- a/docs/.vuepress/components/Plugin.vue +++ b/docs/.vuepress/components/Plugin.vue @@ -36,6 +36,7 @@ @@ -43,6 +44,7 @@ @@ -50,6 +52,7 @@ @@ -57,6 +60,7 @@ @@ -64,6 +68,7 @@ @@ -81,10 +86,7 @@ :disabled="!valid" color="blue darken-1" text - @click=" - dialog = false; - publishPlugin(); - " + @click="publishPlugin" > 发布 @@ -150,6 +152,7 @@ export default { page: 1, dialog: false, valid: false, + rules: [(v) => !!v || "This field is required"], newPlugin: { name: null, desc: null, @@ -176,10 +179,13 @@ export default { displayPlugins() { return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10); }, + }, + methods: { publishPlugin() { if (!this.$refs.newPluginForm.validate()) { return; } + this.dialog = false; const title = encodeURIComponent( `Plugin: ${this.newPlugin.name}` ).replace(/%2B/gi, "+");