There is a problem with the this pointing when the element-ui,select component is searching remotely. Please take a look at it.

the first search is that the data can be rendered normally, but there is a problem with the second this pointing

I have tried to define a variable and pay this to this variable, but it still doesn"t work

<el-select
          v-model="seller"
          filterable
          remote
          reserve-keyword
          placeholder=""
          :remote-method="sellerList"
          :loading="seller.loading">
          <el-option
            v-for="item in seller.list"
            :key="item.id"
            :label="item.account"
            :value="item.id">
          </el-option>
        </el-select>
<script>
  var that;
  export default {
    data () {
      return {
        seller:{
          list:[],
          newlist:[],
          loading: false
        }
      }
    },
    beforeCreate(){
      that = this;
    },
    mounted() {

    },
    methods: {
      
      //
      sellerList(name){
        that.seller.loading = true
        this.$http({
          url: this.$http.adornUrl(`/shop/seller/all`),
          method: "get"
        }).then(({data}) => {
          that.seller.loading = false
          if (data && data.code === 0) {
            that.seller.list = data.list
          } else {
            that.seller.list = []
            this.$message.error(data.msg)
          }
        })
      }
    }
  }

Please help me to see if there is any way to solve this problem


directly change that in sellerList to this . The context of this component does not change the call to this in sellerList , method . Your $http also uses the arrow function to fix the scope, so there is no need to cache

at all.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4dbc1-59fa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4dbc1-59fa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?