效果图
核心代码
此处用到了rich属性
title: {
x: 'center',
text: '{A| ' + that.title + '}', //使用A方案的样式
textStyle: {
rich: {
A: {
//设置背景图片,可以设置width和height,不设置时宽高自适应
backgroundColor: {
image: require('../../assets/images/bm12.png'),
},
color: '#ff0',
padding: [
that.$fontSize.fontSize(0.1),
that.$fontSize.fontSize(0.12),
],
fontSize: that.$fontSize.fontSize(0.16),
},
B: {
backgroundColor: {
image: require('../../assets/images/bm6.png'),
},
},
},
},
},