Code directly
<template>
<view class="container">
<rich-text :nodes="html"></rich-text>
</view>
</template>
<script>
export default {
data() {
return {
html: `<div style='color:red' class='classTest'>hello world</div>`
}
},
methods: {
}
}
</script>
<style>
.classTest{
color: blue !important;
}
</style>
effect
It can be seen that the classTest style is not rendered
Combined with the description of the official website
In other words, it supports class and style attributes, but class must be written in the global
Enter the App.vue file
<style>
.classTest{
color: blue !important;
}
</style>
effect
Perfect solution