letter-spacing 文字之间的间距
rpx: 微信小程序中margin在垂直距离和单个组件中可用px;水平之间的距离最好用rpx,兼容屏幕避免溢出
wx:if="{{false}}" 微信小程序不显示控制
data: img_condition: true wx:if="{{img_condition}}" true/false/变量代表值
冒泡:点击子节点,父节点的事件也会响应 ===catchtap可阻止事件冒泡,bingtap事件冒泡,详情见文档
alt shift f 格式化快捷键
js文件引入数据 module.exports = { key:value } var something = require('data文件的相对路径地址')
require只能是相对路径
template可在目录下建立文件夹,只需要wxml和wxss文件 eg. <template name="ccc">内容</template>
template import 相对路径post-item/post-item-template.wxml 绝对路径/pages/post/post-item/post-item-template.wxml 都行 eg. <import src="post-item/post-item-template.wxml" />
template使用<template is="ccc" data="{{item}}" />
template wxss引入template的css文件 @import "post-item/post-item-template.wxss";
!!! js脚本文件不能引入,小程序的template只是模板化编程,不是模块化编程
!!! template元素不会真实存在,不能在template绑定事件,只是一个占位符
data='{{item}}' item.something data='{{..item}}' something
...item 相当于将item对象展开和平铺,此时数据可以直接引用
block代表总体的列表
Page({
data:{
},
onLoad: function (options) {
// 页面初始化,options为页面跳转所带来的参数
},
onReady: function () {
// 页面渲染完成
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
}
})
wx.navigateTo({
url:'String',
success: function(res){
},
fail: function (res) {
},
complete: function (res) {
}
})