mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-09 10:56:47 +08:00
feat:修改正则
This commit is contained in:
@@ -73,9 +73,8 @@
|
||||
<div class="work">
|
||||
<div style="display: flex; align-items: center">
|
||||
<div
|
||||
id="faceteachnocommon_img_id"
|
||||
style="padding: 5px"
|
||||
class="content"
|
||||
class="content faceteachnocommon_img_class"
|
||||
v-html="data.offcourseDto?.outline"
|
||||
></div>
|
||||
</div>
|
||||
@@ -232,18 +231,18 @@ function formateArr(strs) {
|
||||
return arrs;
|
||||
}
|
||||
|
||||
watch(data, () => {
|
||||
console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
let obj = data.value.offcourseDto.outline;
|
||||
let regex = new RegExp("<img", "gi");
|
||||
let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
obj = obj.replace(deleteStyle, "");
|
||||
obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
data.value.offcourseDto.outline = obj;
|
||||
console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
}
|
||||
});
|
||||
// watch(data, () => {
|
||||
// console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
// if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// let obj = data.value.offcourseDto.outline;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// data.value.offcourseDto.outline = obj;
|
||||
// console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
@@ -251,6 +250,9 @@ watch(data, () => {
|
||||
.faceteachnocommon {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
.faceteachnocommon_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user