Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于rc14版本使用select组件,报请勿修改prop值的异常 #978

Closed
BlueGene89 opened this issue May 22, 2017 · 3 comments
Closed

Comments

@BlueGene89
Copy link

BlueGene89 commented May 22, 2017

iView 版本号

操作系统/浏览器 版本号

Vue 版本号

在用select组件做远程搜索时发现一个vue报的异常

` <template>
  <div>
    <Modal :title="(this.formObject.id > 0)?'编辑服务单元':'添加服务单元'" v-model="showModal" :mask-closable='false' :closable="false" :width=800>
      <Form ref="unitServiceForm" :model="formObject" :label-width="80" :rules="ruleInAddUnitService">
        <Row>
          <Col span="24">
          <Form-item label="人员" prop="emps">
            <Select  v-model="inputSearchEmpId" @on-change="addEmpByCode" filterable remote :loading="empRemoteSeleLoading" :remote-method="remoteMethodEmpSearch" clearable placeholder="请输入工号并选择人员">
              <Option v-for="option in empOptions" :value="option.id" :key="option.id">{{option.empName}}</Option>
            </Select>
          </Form-item>
          </Col>
        </Row>
 </Form>
      <div slot="footer"></div>
    </Modal>
  </div>
</template>`

异常是:

vue.esm.js:434 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "label"

found in

---> <ISelect>
       <FormItem>
         <ICol>
           <Row>
             <IForm>
               <Modal>
                 <MyServiceUnitForm> at C:\Users\Rui\Documents\GitHub\ZSHR\src\components\forms\unitServiceForms\serviceUnitForm.vue
                   <ICol>
                     <Row>
                       <ServiceUnitManage> at C:\Users\Rui\Documents\GitHub\ZSHR\src\views\home\ServiceUnitManage.vue
                         <ICol>
                           <Row>
                             <Home> at C:\Users\Rui\Documents\GitHub\ZSHR\src\views\home\Home.vue
                               <App> at C:\Users\Rui\Documents\GitHub\ZSHR\src\App.vue
                                 <Root>

我常识删除v-modal这句话,异常消失,而且看到是label,我想是不是iview select组件的问题?

@BlueGene89
Copy link
Author

后面我发现,如果v-model="inputSearchEmpId"中的inputSearchEmpId为 int型就会warn,如果是string就不会。。。。

@lvqingan
Copy link
Contributor

我也有这个warning,看了源代码,如果不使用label就会出现问题,prop被赋值了

if (this.label === '') this.label = this.model;

@BlueGene89
Copy link
Author

BlueGene89 commented May 24, 2017

另外一个关于label的问题是:

我有一个table和一个modal,table某行点击详情,调用modal组件内部方法,让该显示字段showModal为true,弹出modal同时方法内调用api得到数据。作为远程搜索,如label功能需要的那样,将获取到的数据给label,然而通过vue tool查看,对应的字段值是改变为api获取了后的,但是label却始终是该字段初始值,未发生改变

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants