element drop-down selects the first one by default

First: Prepare the dom structure

<el-select v-model="value" clearable @change="optionActive(value)" placeholder="请选择">
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
 </el-select>

data() {
    return {
        value:'',
    }
}

Second: Call it in created

created(){
    this.value = this.options[0].value
  },

Guess you like

Origin blog.csdn.net/m0_53591810/article/details/129873968