小程序 | 插槽的使用
Component({ /** * 组件的属性列表 */ options:{ // 启用多插槽 multipleSlots:true }, properties: { text:String }, }) //定义 {{text}} //使用 {{'+'+item.nums}}
Component({ /** * 组件的属性列表 */ options:{ // 启用多插槽 multipleSlots:true }, properties: { text:String }, }) //定义 {{text}} //使用 {{'+'+item.nums}}
// components/like/index.js Component({ /** * 组件的属性列表 */ properties: { like:{ type:Boolean//默认false }, count:{ type:Number//默认0 } }, /** * 组件的初始数据 */ data: { // like:false, // coun
//定义 js // components/book/index.js Component({ /** * 组件的属性列表 */ properties: { book:Object }, /** * 组件的初始数据 */ data: { }, /** * 组件的方法列表 */ methods: { onTap(event){ // 获取选中的id const
定义 common.wxss 引用 @import "../common.wxss"
使用wxs当(过滤器)函数方法使用: util/filter.wxs 定义 //定义 var format=function(text){ if(!text){ return } var reg = getRegExp('\\\\n','g') return text.replace(reg,'\n ') } //定义 // 限制字数 var limit =
// components/epsoide/index.js Component({ /** * 组件的属性列表 */ properties: { index:{ type:String, //观察者模式 属性值被更改时的响应函数 observer:function(newVal,oldVal,changedPath){ // console.log(new
//实例化 const mMgr = wx.getBackgroundAudioManager() import { classicBeh } from '../classic-beh.js' const mMgr = wx.getBackgroundAudioManager() Component({ /** * 组件的属性列表 */ behaviors:
/** * 修改扩展配置文件 * @param array $arr 需要更新或添加的配置 * @param string $file 配置文件名(不需要后辍) * @return bool */ function extraconfig($arr = [], $file = 'extraconfig') { if (is_array($arr)) { $f
1.代码是否有问题 2.编码问题 3.是否开启gd库 4.缓存问题 使用ob_clean(),清除缓存。 ob_clean的作用就是用来丢弃输出缓冲区中的内容,如果你的有许多生成的图片类文件,那么想要访问正确,就要经常清除缓冲区。
wxml 获取用户信息 js onGotUserInfo:function(event){ console.log(event.detail.errMsg)//getUserInfo:ok console.log(event.detail.userInfo)//用户信息 console.log(event.detail.rawData)//json形式的数据