60 lines
1.0 KiB
Markdown
60 lines
1.0 KiB
Markdown
---
|
||
nav:
|
||
title: 函数库
|
||
order: 4
|
||
title: 其它
|
||
order: 4
|
||
---
|
||
|
||
## 获取谷歌浏览器版本
|
||
|
||
```js
|
||
import { getChromeVersion } from '@zhst/func'
|
||
|
||
const version = getChromeVersion()
|
||
```
|
||
## 检索默认时间
|
||
|
||
```jsx
|
||
import React from 'react'
|
||
import { generateTime } from '@zhst/func'
|
||
|
||
const obj = generateTime()
|
||
|
||
export default () => <div>{JSON.stringify(obj)}</div>
|
||
```
|
||
|
||
## 获取字符串实际长度
|
||
|
||
```jsx
|
||
import React from 'react'
|
||
import { getStrLength } from '@zhst/func'
|
||
|
||
const str = getStrLength('测试手动阀手动阀213123dfads')
|
||
|
||
export default () => <div>实际长度为:{str}</div>
|
||
```
|
||
|
||
## 截取字符串
|
||
|
||
```jsx
|
||
import React from 'react'
|
||
import { cutStr } from '@zhst/func'
|
||
|
||
const oldStr = '测试手动阀手动阀213123dfads'
|
||
const str = cutStr(oldStr, 6)
|
||
|
||
export default () => <div>原始数据:{oldStr}<br/> 截取后:{str}</div>
|
||
```
|
||
|
||
## 是否是谷歌浏览器
|
||
|
||
```jsx
|
||
import React from 'react'
|
||
import { isChrome } from '@zhst/func'
|
||
|
||
const isC = isChrome()
|
||
|
||
export default () => <div>是否chrome环境:{isC ? '是' : '否'}</div>
|
||
```
|