微信小程序
呀哈
这个作者很懒,什么都没留下…
展开
-
微信小程序wx.request请求header中携带token值
微信小程序使用接口鉴权时要用到jwt token值需要放在header中在wx.request请求中需要将token值放在header信息中 wx.request({ url: 'http://www.tp.com/api.php/show', header:{ // wx.getStorageSync('token') 从缓存中取出token值 "authorization":"bearer"+wx.getStorageSyn..原创 2022-03-13 20:06:03 · 14761 阅读 · 6 评论 -
微信小程序wxParse富文本解析
首先下载将红框中的文件复制到项目中在js中引用const WxParse=require('../../wxParse/wxParse.js');在wxss中引用@import"/wxParse/wxParse.wxss";在wxml中书写<import src="/wxParse/wxParse"></import><template is="wxParse" data="{{wxParseData:article.nodes}}"/>原创 2022-01-16 21:39:01 · 398 阅读 · 0 评论 -
微信小程序WXS文字截取
先写一个wxs文件function sub_str(str,start,length){ // 起始位置 var offset = start || 0; var len = length || 10; // 判断字符串长度 if(str.length<=len) { return str; } var strnew = str.substring(offset,len); return strnew+"....";}module.expor原创 2022-01-16 21:12:08 · 532 阅读 · 0 评论 -
微信小程序商品详情页面实现三个tab选项卡(商品参数、商品介绍、规格明细)
前段书写 <view class="about"> <!-- 循环展示出tap信息 --> <block wx:for="{{swiperTitle}}"> <view bindtap="tapTitle" data-id="{{index}}" class="{{item.class}}">{{item.name}}</view> </block> </view> <!原创 2022-01-16 21:07:50 · 1323 阅读 · 0 评论 -
微信小程序联想搜索
首先在视图层写一个搜索框<input type="text" placeholder="请输入要搜索的商品名称" bindinput="search"/></view>// 循环输出结果<block wx:for="{{search}}"><view>{{item}}</view></block>在js中方法 search(e){ // 清除之前的定时器 clearTimeout(this.da原创 2022-01-16 20:05:52 · 666 阅读 · 0 评论 -
微信小程序flex布局讲解
flex布局: flex 布局是继 标准流布局 、 浮动布局 、 定位布局 后的第四种布局方式。这种方式可以非常优雅的实现子元素居中或 均匀分布,甚至可以随着窗口缩放自动适应。 flex 布局在浏览器中存在一定的兼容性(具体参 考: https://developer.mozilla.org/zh- CN/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8原创 2022-01-14 20:39:44 · 9786 阅读 · 0 评论 -
微信小程序生命周期函数
请参考:https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/app.htmlApp声明周期函数onLaunch(options): 1. 调用时机:小程序被加载完毕的时候调用。这个方法一般用来做一些初始化的事情。比如获取用户信息、获取 历史缓存信息、获取小程序打开来源等。 2. 参数: | 参数 | 类型 | 说明 | | :--- | :--- | :--- | | path | Strin.原创 2022-01-14 20:51:24 · 865 阅读 · 0 评论