使用前需要先安装cheerio。
因为需要写一个单页模板助手,就用到了cheerio,使用cheerio解析html数据,获取script标签,然后获取src就可以了。
var $ = cheerio.load(that.data);
that.jslist = []
...
3年前 (2022-04-10)
喜欢
安装依赖
npm i cheerio --save
中文文档
中文文档地址
使用
var $ = cheerio.load(that.data);
$('script').map(function (i, el) {
if (el.attribs.src) {
...
3年前 (2022-04-10)
喜欢
js 判断字符串是否包含了指定的内容,并封装,方便复用
代码
export function doesItInclude(string, stringBody) {
var str = new RegExp(string);
return str.test(str...
3年前 (2022-04-10)
喜欢
uniapp开发微信小程序 Ucharts 堆叠条状图
html
<qiun-data-charts type="bar" :opts="optsLine" :chartData="chartDataLine" ...
3年前 (2022-04-09)
喜欢
插件地址
文档地址
插件地址
效果图
代码
<uni-swiper-dot :info="info" :current="currentswiper" field="content" :mode="mo...
3年前 (2022-04-09)
喜欢
在用nodejs仿写单页模板扒手的时候,需要处理下载的css文件内的背景图片和字体文件,在处理前,需要先匹配到对应的文件,这里用正则进行文件匹配。
匹配代码
var pattern = /url\((\S*?)\)/g
console.log(res.data.match(pat...
3年前 (2022-04-08)
喜欢
实例
判断字符串是否是以’//‘开头,如果是则追加’http:‘
var u="//www.wanjunshijie.com"
var url = u
if (u.startsWith('//')) {
url = 'h...
3年前 (2022-04-08)
喜欢
uniapp 微信小程序 Ucharts设置字体大小和颜色
使用fontSize和fontColor设置颜色
"fontSize": 11,
"fontColor": "#9FA3AA",
opt...
3年前 (2022-04-08)
喜欢
uniapp微信小程序开发使用charts折线图, Ucharts需要隐藏折线图上面的label字段, 使用dataLabel:false实现。
dataLabel
<view class="charts-box">
<qiun-da...
3年前 (2022-04-08)
喜欢
最近使用uniapp开发微信小程序,在使用Ucharts时,无论怎么点击就是不显示tooltip,在其他页面又显示正常,研究了一下午,发现是使用了scroll-view。
去掉scroll-view,不在scroll-view内使用就可以了。
...
3年前 (2022-04-08)
喜欢