• 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

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-11-30

匿名通过本文主要向大家介绍了微信小程序等相关知识,希望对您有所帮助,也希望大家支持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好友复制网址打印

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

相关文章

  • 2018-11-30微信小程序之MaterialDesign--input组件
  • 2018-11-30用tp框架实现微信支付的代码实例
  • 2018-11-30关于app应用实例用法汇总
  • 2018-11-30微信小程序商城项目之购物数量加减
  • 2018-11-30滚动消息通知小程序的实例代码展示
  • 2018-11-30微信小程序之关于tabBar底部导航中文注解api的详细介绍
  • 2018-11-30微信小程序中图片如何自适应机型高度
  • 2018-11-30分享小程序的开发流程实例
  • 2018-11-30微信小程序 (三)tabBar底部导航详细介绍
  • 2018-11-30微信小程序仿美团城市选择的实现

文章分类

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

最近更新的内容

    • 如何从小程序外部跳转到指定的小程序页面_小程序页面获取链接
    • 微信小程序http请求的图文详解
    • 关于http请求封装的用法总结
    • 实例讲解微信小程序倒计时功能
    • 微信小程序 教程之WXML
    • 详解如何在不同的移动设备上小程序设置rpx单位
    • 详解小程序开发之wx:key
    • 微信小程序从前端到后台开发步骤还原
    • 微信小程序开发和HTML5开发、css3开发的区别
    • 一起探究微信小程序开发

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

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