Appearance
富文本 - mp-html
复制于 mp-html,强烈建议在项目中使用,以确保风格一致性。
基本用法
vue
<script setup>
const html = `
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<p>这是段落1</p>
<p>这是段落2</p>
`
const tagStyle = {
p: 'font-weight: 400; font-size: 13px; color: rgba(0,0,0,.6);',
h1: 'font-weight: 600; font-size: 15px; color: red;',
h2: 'font-weight: 600; font-size: 14px; color: green;',
h3: 'font-weight: 600; font-size: 13px; color: rgba(0,0,0,1);',
}
</script>
<template>
<mp-nav-bar title="mp-html" />
<view class="content">
<mp-html :content="html" :tag-style="tagStyle" />
</view>
</template>
<style scoped>
.content {
padding: 15rpx;
}
</style>