点击事件:bindtap
navigationBarTitleText:页面的标题---.json
wx:for="{{要循环的数据}}"------花括号 默认的每一项 item index
  wx:for-item="a"  // item  --- a
   wx:for-index="b" // index -- b
wx:key="唯一的字段" 不要加双花括号
// 小程序内想要改变data内的数据并且更新到视图: this.setData({})
// 要想接受 自定义属性传过来的值: e.currentTarget.dataset.
   单个页面要开启下拉刷新:
   1. 页面开启
   找到这个页面的json配置文件:
    "enablePullDownRefresh": true, // 开启下拉刷新
    "backgroundColor": "#000", // 改变背景色
   2. 下拉刷新处理事情
     找到这个页面的js文件:
     onPullDownRefresh(){
       // 处理下拉刷新的事情
      // 强制性停止下拉刷新的状态
       wx.stopPullDownRefresh()
     }
    3. 记忆一个强制性 触发下拉刷新
     wx.startPullDownRefresh()
编程式导航,声明式导航
 声明式:标签navigate
 编程式:点击事件,在js写wx.navigateto
 封装获取接口:
 let baseurl = "https://api-hmugo-web.itheima.net"
 const request = (params) => {
   return new Promise((resolve, reject) => {
     wx.request({
       url: baseurl + params.url,
       method: params.method || "GET",
       data: params.data || "",
       success:resolve
     })
   })
 }
 export default request
 用户未授权,拿到用户昵称、头像的方法:
 <open-data type="userAvatarUrl"></open-data>---昵称
 <open-data type="userNickName"></open-data>----头像
强制让滚动条位置变0
 scrollTop:this.data.scrollTop?0:1
 loading加载:
getlist(){
 wx.showLoading({----------------请求数据前显示loading!!!!!
         title: '加载中'
       });
  wx.showLoading({
         title: '加载中'
       });
       wx.request({
         url: 'https://api-hmugo-web.itheima.net/api/public/v1/categories',
         success: res => {
           wx.hideLoading();-------------数据加载成功去掉loading!!!!!!
           console.log(res);
          // wx.setStorageSync('listdata', res.data.message);
           this.listdata=res.data.message
         }
       });
 }
 页面滚动:
 scroll-y y轴滚动,x x轴滚动 , scroll-top 滚动条位置
     <scroll-view  scroll-top="{{scroo}}" scroll-y="true">
 分包加载:
 tabbar必须放进主包里
 gloabalData-------存放全局的公共数据
防抖:settimeout-------用户输入有停顿,延时执行
 节流:setinterval-------用户上下滑动数据,每隔一段时间执行一次
 debugger断点--------!!!!!!!!!
 联系客服:open-type="contact"-----------
   wx.previewImage------------------轮播图点击出现大图
     counts:当前图片路径,urls:存放大图路径的空数组--循环数组,吧大图路径存进一个空数组里
   wx.chooseAddress({
         success:res=>{
             console.log(res)} ---res是用户信息
         )}   -----------------选择地址
open-type="contact" 添加客服
加入购物车判重,添加到本地:arr.findIndex------!!!!
   let arr = wx.getStorageSync('arr') || []
     let index = arr.findIndex(item => {
       return item.goods_id == this.data.goods_id
     })
     if (index > -1) {
       arr[index].num++
     } else {
       let obj = {
         name: this.data.goodslist.goods_name,
         num: 1,
         goods_id: this.data.goods_id,
         img: this.data.goodslist.goods_small_logo,
         checked: true,
         price: this.data.goodslist.goods_price
       }
       arr.push(obj)
     }
     wx.setStorageSync('arr', arr)
 wx.showToast--------------小提示!!!!!!!!
 事件传播流程:捕获>目标源>冒泡
init ---初始化
 findIndex:-----------------获取下标
  let {shopcars } = this.data
     let index = shopcars.findIndex(item => {
       return item.checked == false     -----获取状态为false的下标
     })
     this.setData({
       checkall: index == -1  ------------为-1说明数据没有状态为false的单选框,所以全选按钮为true
     })
wx.setTabBarBadge-----------只能在tabbar页面设置灰标
 wx.setNavigationBarTitle({   ------------修改头部自定义标题
     title:   -----自定义的名字
     )}
500-------服务器报错
 400-------客户端错误,404路径错误
 300-------重定向错误
 200-------成功
粘性定位:position:sticky;
 this.data.pop() -------------------删除最后一个
过滤器:{{shopcars | filterTotal}}-----view渲染,shocpars购物车数组
 filters:{   ------------------跟methods同级
     filterTotal(arr){
         let num = 0
         arr.forEach(item=>{
         if(item.checked){
         num += item.num
             }
                 })
         return num
             }
         },
分包:
 "subPackages":[
         {
             "root":"fenbao",
             "pages":[
                 {
                     "path":"search/search",
                     "style":{
                         
                     }
                 }
             ]
         }
     ]
行内字符串拼接:
 <view class="red" :style="'height:'+navHeight+'px'">1212</view>










