Utils 工具库 - url 参数转换

url 参数转换

#url解析

#parseUrlParams
  • 代码示例:
<template>
    <div class="wrapper">
        <text>parseUrlParams:url解析 </text>
    </div>
</template>
<script>
export default {
    data:()=> ({
        name: 'parseUrlParams',
    }),
    methods: {
        cloneHandler() {
            let url = 'http://dolphin-weex-dev.msmartlife.cn?name=dolpinweex&num=1&index=10'
            //数据深拷贝
            let res = this.$util.parseUrlParams(url)
            this.$toast(res)
        }
    }
}
</script>
<style scoped>
.wrapper{
    background-color: #ffffff;
}
</style>

#参数

  • 参数详情:
Params Type Required default Value
url String N weex.config.bundleUrl url地址

#url参数序列化

#serializeUrlParams
  • 代码示例:
<template>
    <div class="wrapper">
        <text>serializeUrlParams: url参数序列化 </text>
    </div>
</template>
<script>
export default {
    data:()=> ({
        name: 'serializeUrlParams',
    }),
    methods: {
        cloneHandler() {
            let urlParams = {
                type: 1,
                pageSize: 20,
                pageIndex: 10,
                options: [1,2,3]
            }
            //数据深拷贝
            let res = this.$util.serializeUrlParams(urlParams)
            this.$toast(res)
        }
    }
}
</script>
<style scoped>
.wrapper{
    background-color: #ffffff;
}
</style>

#参数

  • 参数详情:
Params Type Required default Value
data Object N {} 参数
isPrefix Boolean N true 是否自动加上 ?
posted on 2024-12-13 09:20  AtlasLapetos  阅读(20)  评论(0)    收藏  举报