zoukankan      html  css  js  c++  java
  • vue联动效果

    目标效果如下:

     dialog弹出框中增加两个item

              <el-form-item label="维护方式" prop="oprType">
                <el-select class="filter-item" v-model="form.oprType" @change="switchOprType" placeholder="请选择维护方式">
                  <el-option v-for="orTyp in  orTypeOptions" :key="orTyp.id" :label="orTyp.labelDefault" :value="orTyp.value"> </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="属性对象" prop="attrObj">
                <el-input v-model="form.attrObj" v-if="OprTypeFlag == 'input'" placeholder="请录入需要的属性对象"></el-input>
                <el-select class="filter-item" v-model="form.attrObj" v-if="OprTypeFlag == 'select'" placeholder="请录入需要的属性对象">
                  <el-option v-for="attr in  dictOptions" :key="attr.code" :label="attr.name" :value="attr.code"> </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
    

    在data->return{}中定义一个全局变量

    OprTypeFlag: 'default',
    

      生成dialog时默认为文本框,created(){}方法中

    this.OprTypeFlag = 'input';
    

      在methods里面添加切换方法:

        switchOprType() {
          if (event.target.innerText === '下拉框') {
            this.OprTypeFlag = 'select';
            this.form.attrObj = ''
          } else {
            this.OprTypeFlag = 'input';
            this.form.attrObj = ''
          }
        }
    

      

  • 相关阅读:
    ASP.net AJAX Toolkit —— DynamicPopulateExtender
    查找存储过程修改时间
    Application_Start和Application_End事件执行时间
    制作导航菜单
    multiple backgrounds
    background-size
    background-clip
    background-origin
    文本阴影text-shadow
    嵌入字体@font-face
  • 原文地址:https://www.cnblogs.com/tabCtrlShift/p/9066640.html
Copyright © 2011-2022 走看看