Skip to content

Commit

Permalink
refactor: 调整参数保存按钮默认行为
Browse files Browse the repository at this point in the history
当默认服务器未选择时,给予提示。
  • Loading branch information
ronggang committed Jun 19, 2019
1 parent a764cb4 commit 0694f04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/options/views/settings/Base/Index.vue
Expand Up @@ -3,7 +3,7 @@
<v-alert :value="true" type="info">{{ $t('settings.base.title') }}</v-alert>
<v-card color>
<v-card-text>
<v-form v-model="valid">
<v-form v-model="valid" ref="form">
<v-container fluid grid-list-xs>
<v-layout row wrap>
<v-flex xs12>
Expand All @@ -18,6 +18,8 @@
item-value="id"
required
:rules="rules.require"
autofocus
ref="defaultClient"
>
<template slot="selection" slot-scope="{ item }">
<span v-text="item.name"></span>
Expand Down Expand Up @@ -230,7 +232,7 @@
<v-divider></v-divider>

<v-card-actions class="pa-3">
<v-btn color="success" @click="save" :disabled="!valid">
<v-btn color="success" @click="save">
<v-icon>check_circle_outline</v-icon>
<span class="ml-1">{{ $t('settings.base.save') }}</span>
</v-btn>
Expand Down Expand Up @@ -302,6 +304,10 @@ export default Vue.extend({
methods: {
save() {
console.log(this.options);
if (!(this.$refs.form as any).validate()) {
(this.$refs.defaultClient as any).focus();
return;
}
this.$store.dispatch("saveConfig", this.options);
this.successMsg = this.$t("settings.base.saved").toString();
},
Expand Down

0 comments on commit 0694f04

Please sign in to comment.