找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

github精选:微信小程序开发简要

作者:模板之家 2018-4-18 09:48 4125人关注

来自 github 开始之前 注册开发者: https://mp.weixin.qq.com 下载开发工具: https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html 下载官方体验小程序源码: https://mp.weixin.qq.com/debug/wxado ...

来自github

 

开始之前

注册开发者:https://mp.weixin.qq.com 
下载开发工具:https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html 
下载官方体验小程序源码:https://mp.weixin.qq.com/debug/wxadoc/dev/ 
用开发工具添加体验小程序,体验 
官方简易教程:https://mp.weixin.qq.com/debug/wxadoc/dev/ 
组件库:https://mp.weixin.qq.com/debug/wxadoc/dev/component/

 

常见问题及解决方案

本地缓存storage,类似localStorage,可以存取改删 String/Object

  • 页面跳转及传值
 

  1. <navigator url="../detail/detail?name={{item.name}}"></navigator>

跨页面通信,发现一个方案是:https://github.com/danneyyang/weapp-event

  • 组件化

    如模版:header.wxml

 

  1. <template name="header"> <view class="page-header"> <text class="page-header-text">{{title}}</text> <view class="page-header-line"></view> </view> </template>

如何使用?

 

  1. <template is="header" data="{{title: 'start/stopRecord、play/pause/stopVoice'}}"/>
  • 如何请求http数据?

方法:开发者工具-点击项目-勾选开发环境不校验请求域名及TLS版本;

  • Page 内部方法如何调用?方法:this.fn(),例如:
 

  1. fn:function () {
  2. console.log("fn");
  3. },
  4. onReady: function () {
  5. var that = this;
  6. //that = this;
  7. that.fn();
  8. }
  • 底部tabBar菜单栏显示不出来 解决方法:pages先后顺序配置正确,依次是第一个tabBar的路径,第二个tabBar的路径。。app页面的路径,例如:
 

  1. {
  2. "pages":[
  3. "pages/week/index",
  4. "pages/mine/index",
  5. "pages/index/index"
  6. ],
  7. "window":{
  8. "backgroundTextStyle":"light",
  9. "navigationBarBackgroundColor": "#FC3D39",
  10. "navigationBarTitleText": "title",
  11. "navigationBarTextStyle":"white"
  12. },
  13. "tabBar": {
  14. "color": "#9a9a9a",
  15. "selectedColor": "#FC3D39",
  16. "borderStyle": "black",
  17. "backgroundColor": "#ffffff",
  18. "list": [{
  19. "pagePath": "pages/week/index",
  20. "iconPath": "image/calendar.png",
  21. "selectedIconPath": "image/calendar2.png",
  22. "text": "first"
  23. }, {
  24. "pagePath": "pages/mine/index",
  25. "iconPath": "image/mine.png",
  26. "selectedIconPath": "image/mine2.png",
  27. "text": "second"
  28. }]
  29. }
  30. }


路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)