mint-ui 在vue中使用 Action Sheet

最终效果

引入mint-ui后 见上篇

 

actionsheet.vue组件所有代码:

<template>
    <div class="hello">
      <h1 class="page-title">Action Sheet</h1>
      <div class="page-actionsheet-wrapper">
        <button class="mint-button mint-button--default mint-button--large" @click="actionSheet">
          <label class="mint-button-text">点击上拉 action sheet</label>
        </button> 
        </div>
       <mt-actionsheet
          :actions= "data"
          v-model="sheetVisible">
      </mt-actionsheet>
    </div>
</template>

<script>
  export default {
    name: 'hello',
    data () {
      return {
        // action sheet 选项内容
        data: [{
          name: '拍照',
          method : this.getCamera	// 调用methods中的函数
        }, {
          name: '从相册中选择',
          method : this.getLibrary	// 调用methods中的函数
        }],
        // action sheet 默认不显示,为false。操作sheetVisible可以控制显示与隐藏
        sheetVisible: false
      }
    },
    methods: {
      actionSheet: function(){
        // 打开action sheet
        this.sheetVisible = true;
      },
      getCamera: function(){
        console.log("打开照相机")
      },
      getLibrary: function(){
        console.log("打开相册")
      }
    }
  }
</script>

<style scoped>
    
</style>

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值