• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >微信小程序 > 微信小程序:地理位置 API,图片信息 API

微信小程序:地理位置 API,图片信息 API

作者:匿名 字体:[增加 减小] 来源:互联网

匿名通过本文主要向大家介绍了微信小程序等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
wx.chooseLocation(OBJECT)

打开地图选择位置
OBJECT参数说明:
[tr]参数类型必填说明[/tr]

successFunction是接口调用成功的回调函数,返回内容详见返回参数说明。
cancelFunction否用户取消时调用
failFunction否接口调用失败的回调函数
completeFunction否接口调用结束的回调函数(调用成功、失败都会执行)

success返回参数说明:
[tr]参数说明[/tr]

name位置名称
address详细地址
latitude纬度,浮点数,范围为-90~90,负数表示南纬
longitude经度,浮点数,范围为-180~180,负数表示西经


wx.getImageInfo(OBJECT)

获取图片信息
OBJECT参数说明:
[tr]参数类型必填说明[/tr]

srcString是图片的路径,可以是相对路径,临时文件路径,存储文件路径
successFunction否接口调用成功的回调函数
failFunction否接口调用失败的回调函数
completeFunction否接口调用结束的回调函数(调用成功、失败都会执行)

success返回参数说明:
[tr]参数类型说明[/tr]

widthNumber图片宽度,单位px
heightNumber图片高度 单位px

示例代码:

wx.getImageInfo({
    src: 'images/a.jpg',
    success: function(res) {
        console.log(res.width) console.log(res.height)
    }
}) wx.chooseImage({
    success: function(res) {
        wx.getImageInfo({
            src: res.tempFilePaths[0],
            success: function(res) {
                console.log(res.width) console.log(res.height)
            }
        })
    }
})


wx.createAudioContext(audioId)

创建并返回 audio 上下文 audioContext 对象
audioContext

audioContext 通过 audioId 跟一个 audio 组件绑定,通过它可以操作一个 audio 组件。
audioContext对象的方法列表:
[tr]方法参数说明[/tr]

play无播放
pause无暂停
seekposition跳转到指定位置,单位 s

示例代码:

 <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"></span>
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">播放</span>
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">暂停</span>
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">设置当前播放时间为14秒</span>
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">回到开头</span>


audio.jsPage({
    onReady: function(e) { // 使用 wx.createAudioContext 获取 audio 上下文 
        context this.audioCtx = wx.createAudioContext('myAudio')
    },
    data: {
        src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46',
    },
    audioPlay: function() {
        this.audioCtx.play()
    },
    audioPause: function() {
        this.audioCtx.pause()
    },
    audio14: function() {
        this.audioCtx.seek(14)
    },
    audioStart: function() {
        this.audioCtx.seek(0)
    }
})



wx.createVideoContext(videoId)

创建并返回 video 上下文 videoContext 对象
videoContext

videoContext 通过 videoId 跟一个 video 组件绑定,通过它可以操作一个 video 组件。
videoContext对象的方法列表:
[tr]方法参数说明[/tr]

play无播放
pause无暂停
seekposition跳转到指定位置,单位 s
sendDanmudanmu发送弹幕,danmu 包含两个属性 text, color。

示例代码:

<span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"> 
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"/>  
  <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"> 
    <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"/>
  </span>
</span>


更多微信小程序:地理位置 API,图片信息 API相关文章请关注!

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

相关文章

  • 用tp框架实现微信支付的代码实例
  • 微信小程序之自定义模态弹窗实例详解
  • 微信小程序整合一套UI库
  • 怎么开发微信小程序的获取用户手机号功能
  • 微信小程序表单组件 checkbox
  • 微信小程序实现共用变量值的方法介绍
  • 微信小程序 基础组件
  • 微信小程序live-pusher疑惑解答
  • 微信小程序 实战小程序实例
  • 微信小程序 地图map详解及简单实例

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 微信小程序怎么实现蓝牙连接?(代码示例)
    • 分享一个微信群红包算法实例代码
    • 微信小程序路由跳转实例用法总结
    • 关于微信小程序设置启动页面的两种方法介绍
    • 推荐一款极牛逼的小程序开发IDE
    • 关于node.js实现微信支付退款的功能
    • 微信小程序的SocketIO客户端 demo代码
    • 微信小程序开发页面拦截器的详解
    • 小程序开发思维导图,让学习更人性化
    • 微信小程序开发小程序架构篇图解

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有