🐛 fix publish field not required

This commit is contained in:
yanyongyu 2021-09-15 21:03:18 +08:00
parent ca09fb8372
commit e0610fdcc0
3 changed files with 28 additions and 12 deletions

View File

@ -36,6 +36,7 @@
<v-col cols="12">
<v-text-field
v-model="newAdapter.name"
:rules="rules"
label="协议名称"
required
></v-text-field>
@ -43,6 +44,7 @@
<v-col cols="12">
<v-text-field
v-model="newAdapter.desc"
:rules="rules"
label="协议介绍"
required
></v-text-field>
@ -50,6 +52,7 @@
<v-col cols="12">
<v-text-field
v-model="newAdapter.link"
:rules="rules"
label="PyPI 项目名"
required
></v-text-field>
@ -57,6 +60,7 @@
<v-col cols="12">
<v-text-field
v-model="newAdapter.id"
:rules="rules"
label="协议 import 包名"
required
></v-text-field>
@ -64,6 +68,7 @@
<v-col cols="12">
<v-text-field
v-model="newAdapter.repo"
:rules="rules"
label="仓库/主页链接"
required
></v-text-field>
@ -81,10 +86,7 @@
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishAdapter();
"
@click="publishAdapter"
>
发布
</v-btn>
@ -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, "+");

View File

@ -36,6 +36,7 @@
<v-col cols="12">
<v-text-field
v-model="newBot.name"
:rules="rules"
label="机器人名称"
required
></v-text-field>
@ -43,6 +44,7 @@
<v-col cols="12">
<v-text-field
v-model="newBot.desc"
:rules="rules"
label="机器人介绍"
required
></v-text-field>
@ -50,6 +52,7 @@
<v-col cols="12">
<v-text-field
v-model="newBot.repo"
:rules="rules"
label="仓库/主页链接"
required
></v-text-field>
@ -67,10 +70,7 @@
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishBot();
"
@click="publishBot"
>
发布
</v-btn>
@ -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,
"+"

View File

@ -36,6 +36,7 @@
<v-col cols="12">
<v-text-field
v-model="newPlugin.name"
:rules="rules"
label="插件名称"
required
></v-text-field>
@ -43,6 +44,7 @@
<v-col cols="12">
<v-text-field
v-model="newPlugin.desc"
:rules="rules"
label="插件介绍"
required
></v-text-field>
@ -50,6 +52,7 @@
<v-col cols="12">
<v-text-field
v-model="newPlugin.link"
:rules="rules"
label="PyPI 项目名"
required
></v-text-field>
@ -57,6 +60,7 @@
<v-col cols="12">
<v-text-field
v-model="newPlugin.id"
:rules="rules"
label="插件 import 包名"
required
></v-text-field>
@ -64,6 +68,7 @@
<v-col cols="12">
<v-text-field
v-model="newPlugin.repo"
:rules="rules"
label="仓库/主页链接"
required
></v-text-field>
@ -81,10 +86,7 @@
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishPlugin();
"
@click="publishPlugin"
>
发布
</v-btn>
@ -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, "+");