下拉框

Posted hwj369

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了下拉框相关的知识,希望对你有一定的参考价值。

<template>
  <div class="about">
    <h1>about page</h1>
    <el-row>
  <el-col :span="2"><div class="grid-content bg-purple">11</div></el-col>
  <el-col :span="22"><div class="grid-content bg-purple-light">22</div></el-col>
</el-row>
<el-row>
  <el-col :span="2"><div class="grid-content bg-purple"></div>11</el-col>
  <el-col :span="22"><div class="grid-content bg-purple-light">22</div></el-col>
</el-row>
<el-row>
  <el-col :span="2"><div class="grid-content bg-purple"></div>111</el-col>
  <el-col :span="22">
    <el-row>
  <el-col :span="24"><div class="more">
    <div v-show="istrue">
      <ul class="zij">
        <li v-for="(item,index) in zimu" :key="index"
         @click="changeck(item)"
         :class="back==item?‘back‘:‘‘"
         >{{item}}</li>
      </ul>
    </div>
    <div class="dis">
       <div :class="selecttab== ‘all‘?‘change‘:‘unSelected‘">
       
    <el-checkbox-group v-model="checkboxGroup3" size="small" v-if="isshow">
      <el-checkbox-button v-for="city in cities" :label="city"  :key="city">{{city}}</el-checkbox-button>
    </el-checkbox-group>
     <el-checkbox-group v-model="checkboxGroup3" size="small" v-else>
      <el-checkbox-button v-for="city in newlist" :label="city"  :key="city">{{city}}</el-checkbox-button>
    </el-checkbox-group>
  </div>
    <van-button type="primary" size="mini" @click="moreclock">{{news}}</van-button>

    </div>
    
  </div></el-col>
</el-row>
    <el-row>
  <el-col :span="24"><div >已选:{{checkboxGroup3}}</div></el-col>
</el-row>

  </el-col>
</el-row>
   
    

  </div>
</template>
  <script>
  const cityOptions = [上海, 北京, 广州, 深圳,上海, 北京, 广州, 深圳];
export default {
  data(){
    return{
      back:‘‘,
      istr:‘‘,
      selecttab:all,
       checkboxGroup3: [上海],
       checkboxGroup4:[A],
        cities: cityOptions,
        cit:[方法,广告,方法,试试,嘿嘿,
        啊啊,额额,规范,一键,设置,让他,虽然,,
        制作,规范,个人,方法,广告,方法,试试,嘿嘿,],
        newlist:[],
        zimu:[A,B,C,D,E,F,G,H,I,J,
        K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z],

        isshow:true,
        istrue:false,
        news:查看更多

}
  },methods:{
    moreclock(){
      this.isshow=!this.isshow
      this.istrue=!this.istrue
      
      this.selecttab = !this.selecttab
      if (this.isshow) {
        this.news = 查看更多
      }else{
         this.news = 收起
      }
     this.newlist= this.cities.concat(this.cit)
      console.log(this.newlist)
    },
    changeck(i){
         console.log(i)
         this.back = i
         this.istr = true
    }

  },

   mounted(){
     console.log(this.$route.params.id)
   }
}

</script>
<style lang="scss" scoped>
.el-row{
   border: 0.3px solid gray;
   
   & :nth-child(3){
     
   }

}
.more{
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  .change{
    min-height: 40px;
    max-height: 120px;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    // overflow: scroll;
    // overflow-x:hidden;
  }
  .unSelected{
     max-height: 120px;
    overflow: scroll;
     overflow-x:hidden;
    
  }
.zij{
  display: flex; 
  max-width: 80%;
  li{
    padding-left: 10px;
    cursor: pointer;
  }

}
.dis{
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}
  
}
.back{
  color: aqua;
}


</style>

 

以上是关于下拉框的主要内容,如果未能解决你的问题,请参考以下文章

用jquery设置下拉不可编辑,但是没起作用,求高手指点,急。。。

带下拉框的选项代码怎么写?

如何触发下拉框下拉事件

html下拉选择框;html下拉框

如何获取select下拉框的值

EasyUI点击下拉框选中人名后将薪酬数据回显到文本框中,薪酬文本框是用c:if循环出来的,代码见下方,