跳到主要内容

useRendererUserAgent

获取 Webview 小程序的 UserAgent

何时使用

当需要获取 Webview 小程序的 UserAgent

API

const rendererUserAgent = useRendererUserAgent();

参数说明

返回值说明

| 参数 | 类型 | 说明 | | ------ | -------- | -------------------------- | --- | | result | string | Webview 小程序的 UserAgent | |

代码演示

basic/useSystemInfo/index
import React from 'react';
import DemoContent from '@src/components/DemoContent';
import { Cell } from '@taroify/core';
import { useSystemInfo } from 'taro-hooks';

export default () => {
const systemInfo = useSystemInfo();

return (
<DemoContent>
<Cell.Group clickable>
{Object.entries(systemInfo!).map(([key, value]) => (
<Cell key={key} title={key} brief={JSON.stringify(value)}></Cell>
))}
</Cell.Group>
</DemoContent>
);
};

Hook 支持度

微信小程序H5ReactNative
✔️