可以优化此代码吗?我认为它可以优化,我不知道如何。
function changeType(value) {
if (value === "Oracle") {
if (!this.dbForm.port || this.dbForm.port === '3306') {
this.dbForm.port = '1521';
}
if (!this.dbForm.db || this.dbForm.db === 'root') {
this.dbForm.db = 'orcl';
}
}
else if (value === "Mysql") {
if (!this.dbForm.port || this.dbForm.port === '1521') {
this.dbForm.port = '3306'
}
if (!this.dbForm.db || this.dbForm.db === 'orcl') {
this.dbForm.db = 'root';
}
}
}