feat: first commit
This commit is contained in:
3
src/pages/material-webview/index.config.ts
Normal file
3
src/pages/material-webview/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '模卡录屏',
|
||||
});
|
||||
0
src/pages/material-webview/index.less
Normal file
0
src/pages/material-webview/index.less
Normal file
26
src/pages/material-webview/index.tsx
Normal file
26
src/pages/material-webview/index.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import { WebView } from '@tarojs/components';
|
||||
import { getPageQuery } from '@/utils/route';
|
||||
import React, { useState } from 'react';
|
||||
import { useLoad } from '@tarojs/taro';
|
||||
|
||||
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
|
||||
export default function MaterialWebview() {
|
||||
const [src, setSrc] = useState('')
|
||||
|
||||
useLoad(() => {
|
||||
const { source } = getPageQuery<{ source: string }>()
|
||||
setSrc(`https://neighbourhood.cn/material-preview.html?source=${source}`)
|
||||
})
|
||||
|
||||
if (src) {
|
||||
|
||||
return <WebView src={src} onError={() => Toast.error('加载失败请重试')} />;
|
||||
}
|
||||
|
||||
return '加载中...'
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user