vue+mintui+picker弹框选择器

前言:

        实现app端使用mint-ui+popup+picker,弹框加选择效果

实现效果图:

实现步骤:

一、安装mint-ui  详情查看

二、查看具体步骤

1、template部分

 <div id="peopleChorseT" @click="openQuestionType"></div>
 <input type="text" v-model="questionType" placeholder="请输入问题类型">

<!-- 问题类型 -->
     <mt-popup v-model="popupVisible" popup-transition="popup-fade" closeOnClickModal="true" position="bottom">
        <mt-picker :slots="popupSlots" @change="onValuesChange"  showToolbar>
          <div class="picker-toolbar-title">
            <div class="usi-btn-cancel" @click="popupVisible = !popupVisible">取消</div>
            <div class="">请选择问题类型</div>
            <div class="usi-btn-sure" @click="popupOk()">确定</div>
          </div>
        </mt-picker>
    </mt-popup>

2、data部分

      questionType:'',//当前问题类型
      questionTypeVal:'',//当前问题类型-改变后的
      popupVisible:false,//问题类型弹框
      popupSlots:[//问题类型弹框数据
        {
          values:[
            '安全帽','手环','头盔','pad'
          ]
        }
      ],

3、methods部分

    /**
     * 打开问题类型的弹框
     */
    openQuestionType(){
      this.popupVisible = true;
    },
    // 问题类型弹框点击确认
    popupOk(){
      this.questionType = this.questionTypeVal;
      this.popupVisible = false;
    },
    //问题类型的弹框picker值发生改变
    onValuesChange(picker, values){
      this.questionTypeVal = values[0];
    }

4、css样式部分(less


/**用div遮盖住input可以让他实现点击input出来弹框效果 */
#peopleChorseT{
  position: absolute;
  width: 100%;
  top:1.17rem;
  height: 0.6rem;
}
/**问题类型弹框样式 */
.picker-toolbar-title {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  background-color: #eee;
  height: 44px;
  line-height: 44px;
  font-size: 16px;
  .usi-btn-cancel,.usi-btn-sure{
      color:#26a2ff;
      font-size: 16px;
  }
}

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浩星

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值