Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我收到“无法读取未定义属性‘办公室’的下拉列表”错误_Javascript_Vue.js - Fatal编程技术网

Javascript 我收到“无法读取未定义属性‘办公室’的下拉列表”错误

Javascript 我收到“无法读取未定义属性‘办公室’的下拉列表”错误,javascript,vue.js,Javascript,Vue.js,据我所知,一切都设置正确,但它仍然抛出这个错误。我知道数据就在那里,正如我在之前的迭代中所做的一样,它工作得非常好。有什么我遗漏的吗 还是我走错了方向 <div class="col-12"> <div class="form-group"> <label>Escrow Office</label> <v-select class="highlights"

据我所知,一切都设置正确,但它仍然抛出这个错误。我知道数据就在那里,正如我在之前的迭代中所做的一样,它工作得非常好。有什么我遗漏的吗

还是我走错了方向

    <div class="col-12">
      <div class="form-group">
        <label>Escrow Office</label>
        <v-select
            class="highlights"
            :options="select.offices"
            :on-change="selectOffice"
            :searchable="false"
            :clear-search-on-select="false"
            v-model="select.officeSelected"
        ></v-select>
      </div>
    </div>
data() {
  return {
    now: new Date().toISOString(),
    document: {
      escrow_office_id: 1,
    }
  }
},
methods: {
  init(){
    if(this.listing != null) {
            getEscrow() {
               this.page.loading = true;
               axios.get('/api/v2/escrows/' + this.page.id, {headers: {'Authorization': 
               'Bearer ' + this.$root.access_token}})
            .then(response => {
               this.escrow = response.data.escrow;
               this.document.escrow_office_id = response.data.escrow.escrow_office_id;
               this.select.officeSelected = this.select.offices.find(x => x.value === 
               this.form.escrow_office_id);
            })
            .catch(e => {
             var err = (!!e.response ? (!!e.response.data ? (!!e.response.data.error ? 
             e.response.data.error : '') : '') : '');
              if (err != "") this.$noty.error("Error: " + err);
              else this.$noty.error("Cannot call getEscrow()");
            })
            .finally(() => {
            this.page.loading = false;
      });
  },
  getShared() {
    this.select.offices = this.$root.shared.escrow_offices;
  },
  selectOffice(option) {
    this.select.officeSelected = option;
    this.document.escrow_office_id = option.value;
  },
},
    }
  }
}

mounted() {
  this.getShared();
  this.getEscrow();
  setTimeout(() => { this.loaded = true; }, 1000);
},
您需要从数据函数返回select

data() {
    return {
        select: // Your select object
        now: new Date().toISOString(),
        document: {
            escrow_office_id: 1
        }
    };
}

看看约书亚。我没有看到那个错误。谢谢