提供80+媒体资源
我司提供互联网广告营销服务超10年,拥有专业的人才储备
【 服务热线 】4009602809
一、快手广告投放-rich-text
富文本。
属性
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| nodes | string | Array<PropNode> | [] | 否 | 节点列表/HTML String |
| space | 'ensp' | 'emsp' | 'nbsp' | 否 | 显示连续空格 |
space
显示连续空格
| 值 | 说明 |
|---|---|
| 'ensp' | 中文字符空格一半大小 |
| 'emsp' | 中文字符空格大小 |
| 'nbsp' | 根据字体设置的空格大小 |
nodes
现支持两种节点,通过 type 来区分,分别是元素节点和文本节点,默认是元素节点,在富文本区域里显示的 HTML 节点
快手推广-元素节点:type = node
| 属性 | 说明 | 类型 | 必填 | 备注 |
| name | 标签名 | string | 是 | 支持部分受信任的 HTML 节点 |
| attrs | 属性 | object | 否 | 支持部分受信任的属性,遵循 Pascal 命名法 |
| children | 子节点列表 | array | 否 | 结构和 nodes 一致 |
| 属性 | 说明 | 类型 | 必填 | 备注 |
| text | 文本 | string | 是 | 支持 entities |
全局支持 class 和 style 属性,不支持 id 属性。
| 节点 | 属性 |
| a | |
| abbr | |
| address | |
| article | |
| aside | |
| b | |
| bdi | |
| bdo | dir |
| big | |
| blockquote | |
| br | |
| caption | |
| center | |
| cite | |
| code | |
| col | span,width |
| colgroup | span,width |
| dd | |
| del | |
| div | |
| dl | |
| dt | |
| em | |
| fieldset | |
| font | |
| footer | |
| h1 | |
| h2 | |
| h3 | |
| h4 | |
| h5 | |
| h6 | |
| header | |
| hr | |
| i | |
| img | alt,src,height,width |
| ins | |
| label | |
| legend | |
| li | |
| nav | |
| ol | start,type |
| p | |
| pre | |
| q | |
| emsp | |
| rt | |
| ruby | |
| s | |
| section | |
| small | |
| span | |
| strong | |
| sub | |
| sup | |
| table | width |
| tbody | |
| td | colspan,height,rowspan,width |
| tfoot | |
| th | colspan,height,rowspan,width |
| thead | |
| tr | colspan,height,rowspan,width |
| tt | |
| u | |
| ul |
tip: nodes 不推荐使用 String 类型,性能会有所下降。
tip: rich-text 组件内屏蔽所有节点的事件。
tip: attrs 属性不支持 id ,支持 class 。
tip: name 属性大小写不敏感。
tip: 如果使用了不受信任的 HTML 节点,该节点及其所有子节点将会被移除。
tip: img 标签仅支持网络图片。
tip: 如果在自定义组件中使用 rich-text 组件,那么仅自定义组件的 css 样式对 rich-text 中的 class 生效。
| KMSL | JS |
<view class='total'> <view class='wrap'> <view class='title'>通过代码渲染</view> <scroll-view style="height: 80px;" class='scr-v top10' scroll-y>{{code}}</scroll-view> <view class='title top20'>渲染结果</view> <view class='top10'> <rich-text nodes='{{code}}'></rich-text> </view> </view> <!-- <view class='wrap'> <view class='title'>通过节点渲染</view> <scroll-view class='scr-v top10' scroll-y>{{nodesShow}}</scroll-view> <view class='title top20'>渲染结果</view> <view class='top10'> <rich-text nodes='{{nodes}}'></rich-text> </view> </view> --> </view> | const code= `<div class='center'> <h3>I like dog</h3> <img width='100' height='100' src='http://bpic.588ku.com/element_origin_min_pic/16/12/02/61d3bc2e2e340d5f87cf686ce68a07dd.jpg' /> </div>`; const nodesShow = `{ nodes: [{ name: 'div', attrs: { style: 'line-height: 60px; color: #ff5000;' }, children: [{ type: 'text', text: 'I like dog' }] }] }`; Page({ onShareAppMessage(){ return { title: 'rich-text', path: 'page/component/rich-text/index' } }, data: { code, nodesShow, nodes: [{ name: 'div', attrs: { class: 'center', style: 'line-height: 60px; color: #ff5000;' }, children: [{ type: 'text', text: 'I like dog', }] }] }, }) |
| CSS |
.scr-v{ height: 200px; border: 1px solid #eeeeee; white-space: pre; padding: 5px; box-sizing: border-box; } .title{ font-size: 18px; font-weight: bold; } .center{ text-align: center; border: 1px solid #eeeeee; } |

text
文本。
属性
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| selectable | boolean | false | 否 | 文本是否可选 |
| space | 'ensp' | 'emsp' | 'nbsp' | 否 | 显示连续空格 | |
| decode | boolean | false | 否 | 是否解码 |
显示连续空格
| 值 | 说明 |
| 'ensp' | 中文字符空格一半大小 |
| 'emsp' | 中文字符空格大小 |
| 'nbsp' | 根据字体设置的空格大小 |
tip: decode 可以解析的有 < > & '    
tip: 各个操作系统的空格标准并不一致。
tip: text 组件内只支持 text 嵌套。
tip: 除了文本节点以外的其他节点都无法长按选中。
<view class='total'> <view class='wrap'> <view class='title'>可选择文本</view> <view class='txt'> <text ks:for="{{text}}" class='con' selectable>{{item}}</text> </view> </view> </view> |
Page({ onShareAppMessage() { return { title: 'text', path: 'page/component/text/index' } }, data: { text: ['拥抱熟悉的生活', '拥抱新鲜的生活', '拥抱精彩的生活', '拥抱每一种生活'] } }) |
.title{ font-size: 18px; border-bottom: 1px solid #eeeeee; height: 30px; padding-left: 20px; } .txt{ margin: 10px 20px 0px; } .con{ display: block; text-decoration: none; overflow: hidden; } .wrap { padding: 20px 0px; width: 90vw; } |
有关快手广告开户投放等相关问题可以找巨宣网络,公司有着六年的广告投放经验,能帮广告主解决广告制作,推广代运营等服务。提供开户到上线全过程服务流程,从账户下户到上线只需要提供相关资质和素材就可以了。以更高的效率来获取广告带来的效果。
我司提供互联网广告营销服务超10年,拥有专业的人才储备
拥有单账户日消耗百万运营经验,广告账户总量超1万!
账户开通后,提供专业的建站运营服务,百名运营服务!
如无需我司进行代运营,可提供较高返点政策,靠谱!
专注信息流广告/直播广告/搜索广告/短视频广告开户服务!