Skip to content

Commit

Permalink
fix: 修复下载目录定义页面可能无法正常显示的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ronggang committed Aug 8, 2019
1 parent 7d892a5 commit 40fba81
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/options/views/settings/DownloadPaths/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,27 @@ export default Vue.extend({
},
items: [],
dialogRemoveConfirm: false,
selectedClient: {} as any,
selectedClient: {
address: ""
} as any,
lastClientId: ""
};
},
created() {
this.items = this.$store.state.options.clients;
this.initView();
if (
this.$store.state.options.clients &&
this.$store.state.options.clients.length > 0
) {
this.items = this.$store.state.options.clients;
this.initView();
}
},
watch: {
selectedClient() {
this.lastClientId = this.selectedClient.id;
this.updateViewOptions();
if (this.selectedClient && this.selectedClient.id) {
this.lastClientId = this.selectedClient.id;
this.updateViewOptions();
}
}
},
methods: {
Expand Down Expand Up @@ -229,9 +238,13 @@ export default Vue.extend({
this.lastClientId = options.lastClientId;
if (this.lastClientId && this.items.length > 0) {
this.selectedClient = this.items.find((item: any) => {
let selectedClient = this.items.find((item: any) => {
return item.id == this.lastClientId;
});
if (selectedClient) {
this.selectedClient = selectedClient;
}
}
},
/**
Expand All @@ -248,6 +261,9 @@ export default Vue.extend({
},
computed: {
getClientPaths(): any {
if (!this.selectedClient) {
return [];
}
if (!this.selectedClient.paths) {
return [];
}
Expand Down

0 comments on commit 40fba81

Please sign in to comment.