zoukankan      html  css  js  c++  java
  • vue 集成html5 plus

    首先要安装一个包 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

            } )

         })

       },

  • 相关阅读:
    HZNU 2019 Summer training 6
    HZNU 2019 Summer training 5
    HZNU 2019 Summer training 4
    Garlands CodeForces
    HZNU 2019 Summer training 3
    UVA
    HZNU 2019 Summer training 2
    Serge and Dining Room(线段树)
    HZNU 2019 Summer training 1
    【7-10 PAT】树的遍历
  • 原文地址:https://www.cnblogs.com/luobiao/p/10552030.html
Copyright © 2011-2022 走看看