微信小程序开发简要精选

来源:未知 浏览 141次 时间 2021-06-17 10:36

来自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

页面跳转及传值

 

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

跨页面通信SEO关键词可以存取改删 String/Object

页面跳转及传值

 

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

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

组件化

如模版:header.wxml

 

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

如何使用?

 

<template is="header" data="{{title: 'start/stopRecord、play/pause/stopVoice'}}"/>

如何请求http数据?

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

Page 内部方法如何调用?方法:this.fn()网站优化发现一个方案是:https://github.com/danneyyang/weapp-event

组件化

如模版:header.wxml

 

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

如何使用?

 

<template is="header" data="{{title: 'start/stopRecord、play/pause/stopVoice'}}"/>

如何请求http数据?

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

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

 

fn:function () {

console.log("fn");

},

onReady: function () {

var that = this;

//that = this;

that.fn();

}

底部tabBar菜单栏显示不出来 解决方法:pages先后顺序配置正确依次是第一个tabBar的路径第二个tabBar的路径。。app页面的路径例如:

 

{

"pages":[

"pages/week/index",

"pages/mine/index",

"pages/index/index"

],

"window":{

"backgroundTextStyle":"light",

"navigationBarBackgroundColor": "#FC3D39",

"navigationBarTitleText": "title",

"navigationBarTextStyle":"white"

},

"tabBar": {

"color": "#9a9a9a",

"selectedColor": "#FC3D39",

"borderStyle": "black",

"backgroundColor": "#ffffff",

"list": [{

"pagePath": "pages/week/index",

"iconPath": "image/calendar.png",

"selectedIconPath": "image/calendar2.png",

"text": "first"

}, {

"pagePath": "pages/mine/index",

"iconPath": "image/mine.png",

"selectedIconPath": "image/mine2.png",

"text": "second"

标签: httpsltgtpages