Blame view

pages/component/rich-text/rich-text.vue 1.12 KB
4b045f7c   刘淇   江阴初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  <template>
  	<view class="content">
  		<page-head :title="title"></page-head>
  		<view class="uni-padding-wrap">
  			<view class="uni-title uni-common-mt">
  				数组类型
  				<text>\nnodes属性为Array</text>
  			</view>
  			<view class="uni-common-mt" style="background:#FFF; padding:20rpx;">
  				<rich-text :nodes="nodes"></rich-text>
  			</view>
  			<!-- #ifndef MP-ALIPAY -->
  			<view class="uni-title uni-common-mt">
  				字符串类型
  				<text>\nnodes属性为String</text>
  			</view>
  			<view class="uni-common-mt" style="background:#FFF; padding:20rpx;">
  				<rich-text :nodes="strings"></rich-text>
  			</view>
  			<!-- #endif -->
  		</view>
  	</view>
  </template>
  <script>
  	export default {
  		data() {
  			return {
  				title: 'rich-text',
  				nodes: [{
  					name: 'div',
  					attrs: {
  						class: 'div-class',
  						style: 'line-height: 60px; color: red; text-align:center;'
  					},
  					children: [{
  						type: 'text',
  						text: 'Hello&nbsp;uni-app!'
  					}]
  				}],
  				strings: '<div style="text-align:center;"><img src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/ceb770c0-5164-11eb-8a36-ebb87efcf8c0.png"/></div>'
  			}
  		}
  	}
  </script>