# 去除空格
# trim
- 字符串的空格截取
<template>
<div class="wrapper">
<text>trim: 去除字符串空格</text>
</div>
</template>
<script>
export default {
data:()=> ({
name: 'trim',
str: ' hello, dolphinWeex ! '
}),
methods: {
trimHandler() {
let { str } = this
//去除空格
let res = this.$util.trim(str)
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
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
# 参数
- 成功时返回
Params | Type | Required | default | Value |
---|---|---|---|---|
str | String | Y | - | 传入的字符串 |
pos | String | N | both | both | left | right | all |