Skip to content

Commit

Permalink
fix: (price) 修复小程序下符号转义丢失问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1206 committed Jul 24, 2023
1 parent cdaacac commit 9194c4c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/nutui/components/price/price.vue
Expand Up @@ -11,8 +11,17 @@ const classes = computed(() => {
[`${componentName}--strike`]: props.strikeThrough,
}
})
function replaceSpecialChar(url: string) {
url = url.replace(/"/g, '"')
url = url.replace(/&/g, '&')
url = url.replace(/&lt;/g, '<')
url = url.replace(/&gt;/g, '>')
url = url.replace(/&nbsp;/g, ' ')
url = url.replace(/&yen;/g, '')
return url
}
const showSymbol = computed(() => {
const symbol = props.needSymbol ? props.symbol : ''
const symbol = props.needSymbol ? replaceSpecialChar(props.symbol) : ''
return symbol
})
function checkPoint(price: string | number) {
Expand Down

0 comments on commit 9194c4c

Please sign in to comment.