当前位置:网站首页>Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
2022-06-10 15:32:00 【A wooden fish of austerity】
Common methods
Get the current date timestamp
/** * Get the current timestamp */
function time() {
return Math.round(new Date() / 1000);
}
String to timestamp
/** * String to timestamp * @example: time:2022-01-12 12:00:00 */
function stringTotime(time) {
let time_sub= time.substring(0, 19);
time_sub= time_sub.replace(/-/g, "/");
return Math.round(new Date(time_sub).getTime() / 1000);
}
Rich text parsing picture adding prefix or suffix ( Common and processing oss The image processing )
// details
richTxt = richTxt.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
return `<img src='${
this.imgUrl()+p1 + '/okh710auto'}' style="max-width:100%"/>`;
});
- utilize
.replace()( Method is used to replace some characters with others in a string , Or replace a substring that matches a regular expression .) - See documentation https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/replace

边栏推荐
- VINS理论与代码详解4——初始化
- 点击解锁广和通5G模组“关键词”
- Mitm (man in the middle attack)
- Explain the opencv function filter2d() in detail and remind you that the operation it does is not convolution but correlation operation
- 洞察的力量
- 微信小程序 滑动到顶部
- ORB_SLAM2视觉惯性紧耦合定位技术路线与代码详解2——IMU初始化
- 100003 words, take you to decrypt the system architecture under the double 11 and 618 e-commerce promotion scenarios
- After class assignment for module 8 of phase 6 of the construction practice camp
- Hutool Usage Summary (VIP collection version)
猜你喜欢

TensorFlow实战Google深度学习框架第二版学习总结-TensorFlow入门

在什么场景下,我们不能使用箭头函数?

4、再遇Panuon.UI.Silver之窗体标题栏

Detailed explanation of binary search

Day10/11 recursion / backtracking

港大、英伟达 | Factuality Enhanced Language Models for Open-Ended Text Generation(用于开放式文本生成的事实性增强语言模型)

Vins theory and code explanation 4 - initialization

ORB_ Slam2 visual inertial tight coupling positioning technology route and code explanation 1 - IMU flow pattern pre integration

探索数据可视化开发平台FlyFish开源背后的秘密!

Tensorflow actual combat Google deep learning framework second edition learning summary tensorflow introduction
随机推荐
ADA logics:cri-o overall safety audit project
Create a space of local value together. In 2022, China successfully held the "one hundred cities tour · Ningbo Station" for commercial distribution
Development of stm8s103f single chip microcomputer (1) lighting of LED lamp
Jaeger introduces native support for opentelemetry
How the terminator sets the font to display different colors
Comment construire un plan de produit axé sur le client: conseils du CTO
Opentelemetry metrics release candidate
视觉SLAM常见的QR分解SVD分解等矩阵分解方式求解满秩和亏秩最小二乘问题(最全的方法分析总结)
Wechat applet color gradient
We media video Hot Ideas sharing
探索数据可视化开发平台FlyFish开源背后的秘密!
【高代码文件格式API】上海道宁为您提供文件格式API集——Aspose,只需几行代码即可创建转换和操作100多种文件格式
4、再遇Panuon.UI.Silver之窗体标题栏
自媒体视频热门思路分享
虚拟机ping不通的几种原因及解决办法
广和通携手中国移动、惠普、联发科、英特尔合作打造5G全互联PC泛终端系列产品
Day10/11 recursion / backtracking
2022 Nanjing International Smart site equipment exhibition
竟然還有人說ArrayList是2倍擴容,今天帶你手撕ArrayList源碼
Several reasons and solutions of virtual machine Ping failure