第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

【金秋打卡】第10天 全新升級(jí),基于Vue3新標(biāo)準(zhǔn),打造后臺(tái)綜合解決方案 第十講

標(biāo)簽:
Vue.js

课程章节: 列表排序解决方案与实现热门文章排名功能

主讲老师: Sunday

课程内容:

今天学习的内容包括:

创建文章功能的实现

课程收获:

10.1 心得:

"use strict";
var app = getApp();
Component({
  properties: {
    historyKey: {
      type: String,
      value: '',
      observer: "onHistoryKeyChange"
    },
  },


  data: {
    historyList: [],
    isHiddenHistory: false,
    searchList: [],
    isHiddenTips: true,
  },


  methods: {

    onHistoryKeyChange: function onHistoryKeyChange() {
      this.setData({
        historyKey: this.data.historyKey,
      });
      let _this = this;
      wx.getStorage({
        key: this.data.historyKey,
        success(res) {
          if (res.data != undefined && res.data != null && res.data.length > 0) {
            let historyList = JSON.parse(res.data);
            _this.setData({
              historyList: historyList.reverse()
            });
          }
        }
      })
    },

    onBindSearchList: function (e) {
      this.setData({
        searchList: e
      });

      // console.log(this.data.searchList);
    },
    /**
     * 输入内容变化
     * @param {*} e 
     */
    onSearchInputChange: function onSearchInputChange(e) {
      this.setData({
        isHiddenHistory: e.detail.content.length > 0 ? true : false,
        isHiddenTips: e.detail.content.length > 0 ? false : true
      });

      if (e.detail.content.length > 0) {
        this.triggerEvent("onSearchChange", e.detail.content);
      }
    },

    /**
     * 点击搜索
     * @param {*} e 
     */
    onClickSearchSubmit: function onClickSearchSubmit(e) {
      this.setData({
        isHiddenTips: true,
      });
      if (e.detail.content == '') {
        return;
      }
      let isAddToHistoryList = true;
      this.data.historyList.forEach(function (value, index) {
        if (e.detail.content == value) {
          isAddToHistoryList = false;
        }
      });
      if (isAddToHistoryList) {
        this.data.historyList.push(e.detail.content);
        this.setData({
          historyList: this.data.historyList.reverse().slice(0, 5),
        });
        wx.setStorage({
          key: this.data.historyKey,
          data: JSON.stringify(this.data.historyList.reverse().slice(0, 5))
        });
      }
      this.triggerEvent('onClickSubmit', { content: e.detail.content });
    },




    /**
     * 点击搜索历史item
     * @param {*} e 
     */
    onClickHistoryItem: function onClickHistoryItem(e) {
      this.setData({
        isHiddenHistory: true,
      });
      this.searchInput = this.selectComponent("#searchInput");
      this.searchInput.onChangeInputValue(e.detail);
      this.triggerEvent('onClickSubmit', { content: e.detail });
    },

    /**
       * 点击搜索建议item
       * @param {*} e 
       */
    onClickItem: function onClickItem(e) {
      this.setData({
        isHiddenTips: true,
      });
      
      this.searchInput = this.selectComponent("#searchInput");
      this.searchInput.onChangeInputValue(e.currentTarget.dataset.name);

      this.data.historyList.push(e.currentTarget.dataset.name);
      this.setData({
        historyList: this.data.historyList.reverse().slice(0, 5),
      });
      wx.setStorage({
        key: this.data.historyKey,
        data: JSON.stringify(this.data.historyList.reverse().slice(0, 5))
      });
      this.triggerEvent('onClickSubmit', { content: e.currentTarget.dataset.name });
    },

    /**
     * 点击清空历史搜索
     * @param {*} e 
     */
    onClickClearHistory: function onClickClearHistory(e) {
      this.setData({
        historyList: [],
      });
      wx.setStorage({
        key: this.data.historyKey,
        data: JSON.stringify([])
      });
    },



  }
});
.container {
  display: flex;
  background-color: #fff;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  flex-direction: column;
}


.search_tips,.tips_item_container{
  display: flex;
  background-color: #fff;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.search_tips{
  flex-direction: column;
}

.tips_item_container{
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 0;
  margin: 0 32rpx;
  border-bottom: 1rpx solid #F6F6F6;
}

.right_arrow{
  width: 15rpx;
  height: 25rpx;
  flex-shrink: 0;
  margin-left: 10rpx;
  margin-right: 10rpx;
}

.tips_item_content{
  line-height: 34rpx;
  font-size: 24rpx;
  flex-shrink: 0;
  text-align: center;
  color: #333333;
}

图片描述

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消