import React, { useEffect } from 'react'
import Taro from '@tarojs/taro'
import withLayout from '@/layout'
import { WebView } from '@tarojs/components'

export default withLayout((props) => {
  const { router } = props
  const { url, title } = router.params

  useEffect(() => {
    if (title) {
      Taro.setNavigationBarTitle({ title: decodeURIComponent(title) })
    }
  }, [title])

  return (
    <WebView url={decodeURIComponent(url)} />
  )
})
