当前位置:网站首页>Baidu applet rich text parsing tool bdparse
Baidu applet rich text parsing tool bdparse
2022-06-26 09:03:00 【CMS applet plug-in [official]】
Recently doing Baidu applet , It is found that Baidu applet is rarely contacted at present , I can't find the relevant technical support , In particular, rich text processing tools for handling articles . Anyone who has done a wechat applet knows , Wechat has a wxParse, A set of components specially developed for wechat rich text , Can make html A node that is converted into an applet , So I wondered if I could wxParse Transformed into Baidu applet .
Because the code similarity between Baidu applet and wechat applet is larger 95% above , Almost wechat wxml,js Request and label batch replacement with Baidu swan,js Of ,css and json Completely universal , This also includes rich text nodes exactly the same , So try to transform , The cycle used for Baidu and wechat is different from the template call , So it took some time , In order to distinguish between wxParse, So change your name bdParse.
bdParse Project download address :https://gitee.com/sootou/bdparse
Project introduction
Baidu applet rich text parsing tool bdParse, Remodel from wxparse, Support html Convert to Baidu applet rich text node .
Installation tutorial
- Download the entire file , Put it in your applet root directory
- On the applet page js Direct introduction of code :
var bdParse = require('../../bdParse/bdParse.js'); Corresponding css Introduction in@import "../../bdParse/bdParse.css"; - Use... In the required fields baparse, Code :( Be careful :article and content Don't repeat )
that.setData({ content:bdParse.bdParse('article', 'html', content, that, 5), }) - swan Page import template ,
<import src="../../bdParse/bdParse.swan" />Then call... Where you need to display rich text :<template is="bdParse" data="{ { {bdParseData:article.nodes} }}" />( Be careful :data The call is changed to and wxParse Consistent writing , Notice the three braces , The original direct writing { {article}} No longer supported , Please pay attention to the modification )
Instructions
- swan Calling the template data="{ { {bdParseData:article.nodes} }}" and setData Medium article bring into correspondence with .
- call bdparse Component time , The component has assigned the rich text content ( namely setData) Give it to article;{ { {bdParseData:article.nodes} }} This way of writing means : hold article.nodes The content of is assigned to bdParseData,bdParse.swan What is called is bdParseData.
Other instructions
- bdParse Is in wxParse On the basis of , Just put wxParse Replace with bdParse, contain js,swan, css
- wxml Change the suffix to swan, In addition, the calling method of all template value transfer has been modified , Conform to the use of Baidu applet .
- Fixed proprietary components of other Baidu applets , such as s-for,s-if,s-elif,s-for-index wait
- Fix other problems , For example, remove
<template name="wxParseImg">Repetitive mode, To all s-for-index add to idx( It seems that it cannot be empty ). - Other modifications , I won't repeat
- Because the content is replaced directly in batches , Basic articles can meet the needs of , Others have not done much testing , Welcome your feedback bug
Participation and contribution
- developer : Jianteng stone station
- Official website :http://www.tengcee.com
- bdParse.swan Remodel from wxParse.wxml
- wxParse The original author github Address : https://github.com/icindy/wxParse
It's not easy , Support a lot
If you think bdParse Helped you solve the problem , Please don't forget to reward , Your support is our biggest motivation .

边栏推荐
- Degree of freedom analysis_ nanyangjx
- 【云原生 | Kubernetes篇】深入万物基础-容器(五)
- Simulation of parallel structure using webots
- commonJS和ES6模块化的区别
- Mongodb分片环境搭建和验证(redis期末大作业)
- 拦截器与过滤器的实现代码
- 1.21 study logistic regression and regularization
- 深度学习论文阅读目标检测篇(七)中文版:YOLOv4《Optimal Speed and Accuracy of Object Detection》
- phpcms小程序插件教程网站正式上线
- HDU - 6225 Little Boxes(__int128的使用)
猜你喜欢
随机推荐
Leetcode notes: binary search simple advanced
PD快充磁吸移動電源方案
Clion installation + MinGW configuration + opencv installation
Yolov5 advanced zero environment rapid creation and testing
PD fast magnetization mobile power supply scheme
滑块验证 - 亲测 (京东)
在哪个软件上开户比较安全
HDU - 6225 little boxes (\u int128)
Fast construction of neural network
Section IV HQL execution process
Use of PCL
直播回顾 | smardaten李鸿飞解读中国低/无代码行业研究报告:风向变了
Trimming_ nanyangjx
Speckle denoising method for ultrasonic image
Optimize quiver function in MATLAB to draw arrow diagram or vector diagram (1) -matlab development
1.17 daily improvement of winter vacation learning (frequency school and Bayesian school) and maximum likelihood estimation
Playing card image segmentation
Pandas vs. SQL 1_ nanyangjx
【微积分】拉格朗日乘子法
基于SSM的电脑商城





![[program compilation and pretreatment]](/img/c9/45353cf6578628ad44f149350873f5.png)



