直接コーディングする
<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>
効果
classTestスタイルがレンダリングされていないことがわかります
公式サイトの説明と合わせて
つまり、クラスとスタイルの属性をサポートしますが、クラスはグローバルで記述する必要があります
App.vueファイルを入力します
<style>
.classTest{
color: blue !important;
}
</style>