import { FC, ReactNode} from "react";
import {View} from "@tarojs/components";
import Taro from "@tarojs/taro";



interface TabLinkProps{
  className:string
  url:string
  children: ReactNode[]
}

const TabLink:FC<TabLinkProps> = (props:TabLinkProps) => {
  function linkTab(){
    console.log(props.url)
    let webExp= new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/)
    if(webExp.test(props.url)){
      //跳转webview
      Taro.navigateTo({url:`/pages/preview/webView/webView?url=${props.url}`})
    }else{
      //跳转小程序页面
    }
  }

  return (
    <View onClick={linkTab} className="font-28" style={{display:"inline-block",color:'#45D4A8'}}>22222</View>
  )
}

export default TabLink
