Google推出SearchHistory(Beta)

Google推出了SearchHistory服务,目前还是Beta版,可以记录下你的搜索历史,日后可以看出自己的搜索频度,只要你有Gmail帐号就可以体验了[http://www.google.com/searchhistory/],搜索变得更加有趣起来:)

我的搜索历史:
此主题相关图片
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<template> <view> <text class="text-title">翻译历史:</text> <uni-list v-for="(elem,index) in searchHistory" :key="index"> <uni-list-item :title="elem.searchValue" :rightText="getLanguageTransfer(elem.fromLanguage,elem.toLanguage)" @click="itemClick(elem)" clickable></uni-list-item> </uni-list> </view> </template> <script> import { sha256 } from 'js-sha256'; export default { data() { return { searchHistory: [], array: [{ name: '中文', code: 'zh-CHS' }, { name: '英文', code: 'en' }, { name: '德文', code: 'de' }, { name: '日文', code: 'ja' }, { name: '法文', code: 'fr' }, { name: '韩文', code: 'ko' }] } }, methods: { itemClick(data) { if (data.searchValue.length > 0) { console.log(data.searchValue); console.log(data.fromLanguage); console.log(data.toLanguage); let salt = (new Date).getTime(); let appKey = '03949e1a6a334f86'; let appSecret = '9u6wiw517BYJ8ggnFIdcwoYGmqtsOHUl'; let curtime = Math.round(new Date().getTime() / 1000); let input = data.searchValue.length <= 20 ? data.searchValue : data.searchValue.slice(0, 10) + data .searchValue.length + data.searchValue.slice(-10); uni.request({ url: '/youdaoApi/api', url: 'https://openapi.youdao.com/api', method: 'GET', data: { q: data.searchValue, from: data.fromLanguage, to: data.toLanguage, appKey: appKey, salt: salt, curtime: curtime, sign: sha256(appKey + input + salt + curtime + appSecret), signType: 'v3' }, success: (data) => { this.$store.commit('setOutcome', data); uni.switchTab({ url: '/pages/translateresult/translateresult' }); } }) } }, getLanguageTransfer(from, to) { let fromStr = this.array.find(item => { return item.code == from; }); let toStr = this.array.find(item => { return item.code == to; }); return fromStr.name + '->' + toStr.name; } }, onshow() { this.searchHistory = Array.from(this.$store.getters.getHistoryList); console.log(this.searchHistory); console.log("1" + this.$store.getters.getHistoryList); this.serachHistory.reverse(); } } </script> <style> .text-title { font-size: 45rpx; color: coral; margin-top: 100rpx; } </style>
最新发布
06-07

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值