uniapp之富文本rich-text的使用

<template>
    <view>
        <rich-text :nodes="nodes" bindtap="tap"></rich-text>
    </view>
</template>

<script>
export default {
    data() {
        return {
            nodes: [
                {
                    name: 'div',
                    attrs: {
                        class: 'div_class',
                        style: 'line-height: 60px; color: red;'
                    },
                    children: [
                        {
                            type: 'text',
                            text: 'Hello&nbsp;World!'
                        },
                        {
                            name:"img",
                            attrs: {
                                style: 'width: 100px;',
                                src:'http://photocdn.sohu.com/20120910/Img352705474.jpg'
                            },
                        }
                    ]
                },
            ]
        }
    },
    methods: {
        tap() { 
             console.log('tap')
        }
    }
}
</script>

<style>

</style>

备注:img 标签仅支持网络图片。

富文本.png

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容