Commit 9df82257 by 李伟康

commit 提交

1 parent c357829e
......@@ -2,7 +2,7 @@
<view class="wn-canvas">
<zoom-pan
:class="['canvas-box',{fill:custom}]"
:disabled="drawStatus"
:disabled="drawStatus || !scaleSwitch"
:scale-max="5"
:scale-min="1"
@scale="scale"
......@@ -169,6 +169,10 @@ export default {
default: 'drawCanvas'
},
custom: Boolean, //自定义
scaleSwitch:{
type: Boolean,
default: true
}
},
computed: {
watchStatus () {
......
......@@ -5,6 +5,7 @@
:drawStatus="penSwitch"
custom
@scale="$emit('scale',$event)"
:scaleSwitch="false"
>
<template slot="customContent">
<view class="title">
......
......@@ -117,6 +117,7 @@ export default {
color: #292d33;
line-height: 48rpx;
overflow-y: auto;
word-break: break-all;
}
}
</style>
\ No newline at end of file
......@@ -207,7 +207,7 @@ export default {
e.checked = true
e.main = e.itemName == '交强险' ? '交强险' : '商业险'
e.show = false
e.itemDesc = this.processHtmlString(e.itemDesc)
e.itemDesc = e.itemDesc ? this.processHtmlString(e.itemDesc) : ''
})
if (!storageInsuranceList) {
uni.showLoading({
......@@ -246,11 +246,17 @@ export default {
this.flag = true
},
processHtmlString (htmlString) {
const regexStyle = /style="[^"]*"/g
const regexBr = /<\/br>|<br>|<br\/>|\n/g
let processedString = htmlString.replace(regexBr, '<div></div>')
let newHtmlString = processedString.replace(regexStyle, '')
return newHtmlString
// 移除 `<br>` 及其变体,并用 `<div></div>` 替换
let processedString = htmlString.replace(/<\/?br\s*\/?>|\n/g, '<div></div>')
// 移除 `style` 属性
processedString = processedString.replace(/style="[^"]*"/g, '');
// 移除 `<strong>`, `</strong>`, `<em>`, `</em>` 和孤立的 `<` 标签
processedString = processedString.replace(/<strong>|<\/strong>|<em>|<\/em>|<>/g, '');
// 替换非 `div` 和非 `span` 的 HTML 标签
processedString = processedString.replace(/<(?!div|span)[^>]*>/g, '<div>');
processedString = processedString.replace(/<\/(?!div|span)>/g, '</div>');
return processedString
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!