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

            } )

         })

       },

  • 相关阅读:
    特征方程
    鸽巢原理
    Python列表与字典
    布尔型
    python字符串
    Python小笔记
    IntelliJ 中Maven pom.xml依赖不生效解决
    IDEA创建servlet,篇末有找不到servlet报404的原因
    jQuery的ajax之验证用户名是否被注册
    jquery之Validata表单验证
  • 原文地址:https://www.cnblogs.com/luobiao/p/10552030.html
Copyright © 2011-2022 走看看