Elementui resetFields doesn't work. Please adjust it online many times.

topic description

Click on the resetForm form should be reset, but there is no

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< div class= "selectWrap" >

    <el-form :model = "form" ref="dataForm">
      <div class="clearfix">
        <div class="select-item selectDIV ershisan">
          <el-form-item prop="reset">
            <el-button @click="resetForm" class="dagongji"></el-button>
          </el-form-item>
          <!--<a @click="resetForm" class="dagongji"></a>-->
          <el-form-item prop="selectarea">
            <el-select class="bashisan" @change="search" style="width: 100%" v-model="form.area" :popper-append-to-body="false" collapse-tags clearable multiple filterable placeholder="">
            <el-option v-for="item of adminUserAreas" :key="item.areaId" :label="item.regionName" :value="item.areaId"></el-option>
          </el-select>
          </el-form-item>
        </div>
        <!--<div @click = searchdb >quanguo</div>-->
        <div v-if="!isHome" class="select-item">
          <el-select
            @change="search"
            style="width: 100%"
            filterable
            clearable
            :popper-append-to-body="false"
            v-model="form.examClasses"
            placeholder=""
            multiple collapse-tags>
            <el-option v-for="item in examClasses" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </div>
        <div v-if="!isHome" class="select-item">
          <el-input v-model="form.classname" placeholder="">
            <i @click="search" slot="suffix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </div>
        <div class="select-item dateDIV">
          <el-date-picker
            @clear="search"
            @change="dateChange"
            v-model="form.date"
            type="daterange"
            value-format="timestamp"
            range-separator="" style="width: 100%" start-placeholder="" end-placeholder="">
          </el-date-picker>
        </div>
        <div v-if="isHome" class="select-item radioDIV hidemove">
          <el-radio-group @change="radioChange" v-model="form.radio">
            <el-radio-button label="7"></el-radio-button>
            <el-radio-button label="30"></el-radio-button>
            <el-radio-button label="90"></el-radio-button>
          </el-radio-group>
        </div>
      </div>
    </el-form>
  </div>
  
  resetForm () {
  this.$nextTick(() => {
    this.$refs["dataForm"].resetFields()
  })
  this.search()
  this.$router.push({name: "echart "})
}

what result do you expect? What is the error message actually seen?

expect form or form.area to be emptied


if you can, you can use jsfiddle to give an executable code. The element official form reset method is resetFields
. If you can't, define the data of a default form first

.
  
  1. use this.$refs instead of this.$ref
  2. with this.$nextTick (() = > {})
  3. model / ref in el-form and prop in el-form-item check it again
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-1b356d2-2bf97.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-1b356d2-2bf97.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?