luobiao

首先要安装一个包 vue-html5plus 

  npm i vue-html5plus -S

然后配置这个文件

在main.js添加一串代码

  var onPlusReady = function (callback, context = this) {

    if (window.plus) {

      callback.call(context)

     } else {

      document.addEventListener(\'plusready\', callback.bind(context))

     }

  }

  Vue.mixin({

     beforeCreate () {

      onPlusReady(() => { this.plusReady = true }, this)

     },

    methods: {

      onPlusReady: onPlusReady

    }

  })

这样就可以集成html5 plus了

使用方法示例:(获取地理位置)

  mounted () {

    this.onPlusReady(function () {

      plus.geolocation.getCurrentPosition( 

         this.geoInf, function (e) {

          alert(\'获取位置信息失败:\' + e.message)

        },

         {

           geocode: false

        } )

     })

   },

 

分类:

技术点:

相关文章:

  • 2021-09-11
  • 2021-12-12
  • 2021-08-29
  • 2021-06-12
  • 2021-10-21
  • 2021-05-26
  • 2021-12-18
  • 2021-06-26
猜你喜欢
  • 2021-05-20
  • 2021-12-14
  • 2021-11-21
  • 2021-04-04
  • 2021-09-24
  • 2022-01-03
相关资源
相似解决方案