## 设置页面标题 SetPageTitle
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
title | String | 是 | 标题名称
### 示例
```
this.$Tool.SetPageTitle("这是页面标题")
```
## 时间长度 TimeHowLong
显示时间戳为多长
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
time | int | 是| 时间戳,精确到秒
### 示例
```
let res = this.$Tool.TimeHowLong("1231231231")
console.log('多少年',res.y)
console.log('多少月',res.m)
console.log('多少日',res.d)
console.log('多少时',res.h)
console.log('多少分',res.i)
console.log('多少秒',res.s)
```
## 时间戳格式化 FormatTimeText
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
time | int | 是| 时间戳,精确到秒
format | int | 是| 格式类型,默认是 YYYY-MM-DD HH:mm:ss
### 示例
```
let res = this.$Tool.TimeHowLong("1231231231","MM-DD HH:mm:ss")
```
## 时间戳格式化 SetLanguage
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
lang | String | 是| 选择的语音,zh-CN 中文、en-US 英文
### 示例
```
let res = this.$Tool.SetLanguage("zh-CN")
```
## 防抖 Debounce
防止事件误触多次触发(例如表单提交事件)
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
fn | Function | 是| 需要防止抖动的函数
delay | Number | 否| 防抖延迟时间
immediate | Boolean | 否 | 是否立即执行,默认 = true
### 示例
```
<template>
<div class="page">
<view class="box">
<view class="title">防抖(请在点击下面对应区域)</view>
<view class="">
<view class="flex-ccc block" @click="HandleDebounce(3)">
<text>{{ Debounce.num3 }}</text>
<text>节流立即执行</text>
</view>
</view>
</view>
</div>
</template>
<script>
export default {
data() {
return {
Debounce: {
num3: 0
},
DebounceNum3: null
};
},
methods: {
// 分流
HandleDebounce(type) {
this.DebounceNum3('num3')
},
// 自增处理
AddNumThrottle(key) {
if (key) {
this.Debounce[key]++;
}
}
},
onReady() {
// 防抖方法
this.DebounceNum3 = this.$Tool.Debounce({
fn: this.AddNumThrottle,
});
}
};
</script>
```
## 节流 Throttle
限制事件在一定时间的触发次数
### 平台
- 全平台
### 参数
名称 | 类型 | 是否必填|说明
:-----------: | :-----------: | :-----------: | -----------
fn | Function | 是| 需要节流的函数
delay | Number | 否| 触发时间间隔
immediate | Boolean | 否 | 是否立即执行,默认 = true
### 示例
```
<template>
<div class="page">
<view class="box">
<view class="title">节流(请在下面对应区域滑动)</view>
<view class="">
<view class="flex-ccc block" @touchmove="HandleThrottle(3)">
<text>{{ Throttle.num3 }}</text>
<text>节流立即执行</text>
</view>
</view>
</view>
</div>
</template>
<script>
export default {
data() {
return {
Throttle: {
num3: 0
},
ThrottleNum3: null
};
},
methods: {
// 分流
HandleThrottle(type) {
this.ThrottleNum3('num3')
},
// 自增处理
AddNumThrottle(key) {
if (key) {
this.Throttle[key]++;
}
}
},
onReady() {
// 节流方法
this.ThrottleNum3 = this.$Tool.Throttle({
fn: this.AddNumThrottle,
});
}
};
</script>
```
## 小程序版本更新 UpdateManager
限制事件在一定时间的触发次数
### 平台
- 全小程序
### 参数
无
### 示例
```
this.$Tool.UpdateManager()
```
## APP 启动页面 GetStartPic
限制事件在一定时间的触发次数
### 平台
- APP
### 参数
无
### 示例
```
this.$Tool.GetStartPic()
```