H5APP中使用vue拨打用户电话

简单粗暴调用函数

直接调用这个函数就可以了,

//拨打电话
        GetPhone(){
          if (window.plus) {
            plus.device.dial(‘要拨打的电话号’, true);
          }
        },

这个弹窗是基于vux,要用弹窗的话可以下载vux,不要的话不用往下看了,手机号我也不知道谁的,看见了别乱打。。。。。

在这里插入图片描述

npm install vux --save

在build/webpack.base.conf.js要进行修改的代码

const vuxLoader = require('vux-loader')
const webpackConfig = originalConfig // 原来的 module.exports 代码赋值给变量 webpackConfig

module.exports = vuxLoader.merge(webpackConfig, {
  plugins: ['vux-ui']
})

咳咳

<p @click="Call">拨打电话</p>




    <popup v-model="isDetail" height="1.34rem">
      <div class="Img">
        <p>拨打电话</p>
        <span>确认要拨打电话{{Mobile}}吗?</span>
        <div class="qu" @click="GetPhone">确定</div>
        <div class="CloseT" @click="CloseT">关闭</div>
      </div>
    </popup>








函数调用:

 
<script>
  import { Swiper,Popup} from 'vux'
    export default {
      components: {
        Swiper,Popup
      },
        name: "about",
      data(){
          return{
            isDetail:false,
            Mobile:''
          }
      },
      methods:{
        //拨打电话
        GetPhone(){
          if (window.plus) {
            plus.device.dial(this.Mobile, true);
          }
        },
        //隐藏电话弹窗
        CloseT(){
          this.isDetail = false
        },
        //展示电话弹窗
        ShowK(){
          this.isDetail = true
        },
      },
    }
</script>

css


    .vux-popup-dialog{
      width: 2.8rem;
      position: fixed;
      left: 50%;
      top: 50%;
      margin-left: -1.4rem;
      margin-top:-0.67rem;
      .Img{
        position: relative;
        background: #fff;
        width: 2.8rem;
        height: 1.34rem;
        overflow: hidden;
        p{
          font-size: .2rem;
          text-align: center;
          color: #414141;
          line-height: .5rem;
        }
        span{
          color: #666;
          display: block;
          font-size: .14rem;
          text-align: center;
        }
        .qu{
          width: .9rem;
          font-size: .14rem;
          text-align: center;
          line-height: .3rem;
          color: #fff;
          height: .3rem;
          position: absolute;
          background: #37dcc9;
          left: .25rem;
          bottom: .2rem;
        }
        .CloseT{
          width: .9rem;
          font-size: .14rem;
          text-align: center;
          line-height: .3rem;
          color: #fff;
          height: .3rem;
          position: absolute;
          background: #999999;
          right: .25rem;
          bottom: .2rem;
        }
      }
    }

我是一个很菜的前端美工!!!!!完毕!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值