diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f06dcc5..1215974 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -24,11 +24,15 @@ export class Connection extends BI.Widget { title: HTapeLayout; watch = { - connectionSelected: { + connectionSelectedOne: { immediate: true, - handler: (name: string) => { + handler: (v: Connection) => { BI.nextTick(() => { - name ? this.renderConnectionListView(name) : this.renderEmptyListView(); + const connectionName = v.connectionName; + + connectionName + ? this.renderConnectionListView(connectionName) + : this.renderEmptyListView(); }); }, }, diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 3d30378..b1bc9d2 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -44,7 +44,7 @@ export class ConnectionListModel extends Model<{ // 仅首次进入时从url中读取参数,其他情况保留选中状态 defaultDatabaseName ||= data.data[0].connectionName; - this.setSelectedConnection(this.model.connectionSelected || defaultDatabaseName); + this.setSelectedConnection(defaultDatabaseName); } return new Promise(resolve => {