# 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>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 参数

  • 参数详情:
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>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

# 参数

  • 参数详情:
Params Type Required default Value
data Object N {} 参数
isPrefix Boolean N true 是否自动加上 ?
Last Updated: 2/1/2021, 11:33:56 AM