HarmonyOS 有没有api可以解析url地址的?

"mk:///WebView?fullscreen=true&opaque=true&progress_hidden=true&busy_hidden=false&url=https%3A%2F%2Fintouch-coach-app.uat.mybiz-eks-chn.mkiapp.com%2Femployee"

有没有api可以方便的解析类似于这种结构的地址的?

HarmonyOS
2024-12-27 14:53:38
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
superinsect

url解析如下:

// xxx.ets
import Url from '@ohos.url'
@Entry
@Component
struct ButtonExample {
  build() {
    Column(){
      Button('点击')
        .onClick(()=>{
          let urlParams = "mk:///WebView?fullscreen=true&opaque=true&progress_hidden=true&busy_hidden=false&url=https%3A%2F%2Fintouch-coach-app.uat.mybiz-eks-chn.mkiapp.com%2Femployee"
          let decodeURL = decodeURIComponent(urlParams);
          let paramsObject = new Url.URLParams(decodeURL);
          console.log('progress_hidden:'+ paramsObject.get("progress_hidden"))
          console.log('busy_hidden:'+ paramsObject.get("busy_hidden"))
          console.log('url:'+ paramsObject  .get("url"))
        })
    }
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
分享
微博
QQ
微信
回复
2024-12-27 17:32:39
相关问题
HarmonyOS 有没有api可以改应用包名?
1041浏览 • 1回复 待解决
有没有api可以杀掉当前进程
2094浏览 • 1回复 待解决
HarmonyOS 有没有图片取色API
817浏览 • 1回复 待解决
HarmonyOS 有没有单指旋转api
926浏览 • 1回复 待解决
HarmonyOS 有没有单指旋转api
997浏览 • 0回复 待解决
有没有获取设备api
1023浏览 • 1回复 待解决
HarmonyOS 地址解析问题
698浏览 • 1回复 待解决
HarmonyOS 有没有清除通知相关API
972浏览 • 1回复 待解决
有没有获取当前网速api?
5375浏览 • 1回复 待解决
HarmonyOS 有没有api实现DES加密
636浏览 • 1回复 待解决
HarmonyOS url字符串怎么解析
614浏览 • 1回复 待解决