useRendererUserAgent
获取 Webview 小程序的 UserAgent
何时使用
当需要获取 Webview 小程序的 UserAgent
API
const rendererUserAgent = useRendererUserAgent();
参数说明
无
返回值说明
| 参数 | 类型 | 说明 |
| ------ | -------- | -------------------------- | --- |
| result | string
| Webview 小程序的 UserAgent | |
代码演示
- React
- Vue
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>
);
};
basic/useSystemInfo/index
<template>
<demo-content>
<nut-cell
v-for="(value, key) in systemInfo"
:key="key"
:title="key"
:sub-title="$filters.stringify(value)"
></nut-cell>
</demo-content>
</template>
<script setup lang="ts">
import { useSystemInfo } from 'taro-hooks';
const systemInfo = useSystemInfo();
</script>
Hook 支持度
微信小程序 | H5 | ReactNative |
---|---|---|
✔️ |