index.tsx 495 B

123456789101112131415161718192021
  1. import { WebView } from "@tarojs/components";
  2. import Taro, { FC, useRouter } from "@tarojs/taro";
  3. import { useEffect } from "react";
  4. const IframePage: FC = () => {
  5. const route = useRouter();
  6. useEffect(() => {
  7. if (route.params.title) {
  8. Taro.setNavigationBarTitle({
  9. title: route.params.title,
  10. });
  11. }
  12. }, []);
  13. return route.params.url ? (
  14. <WebView src={decodeURIComponent(route.params.url)} />
  15. ) : null;
  16. };
  17. export default IframePage;