保存图片文件,下载图片
function downloadIamge(imgsrc, name) { //下载图片地址和图片名
let image = new Image();
// 解决跨域 Canvas 污染问题
image.setAttribute("crossOrigin", "anonymous");
image.onload = function () {
let canvas = document.createElement("canvas");
...
赛邮云通信SUBMAIL
NodeJs发送短信var request = require('request');
let post = function (url, postdata) {
let options = {
url: url,
formData: postdata
};
return new Promise(function (resolve, reject) {
request.post(options, function (err, response, body) {
...
根据元素宽度设定高度比例
要求:图片根据宽度设置高度。正方形.shopimg {
width: 100%;
height: 0;
padding-bottom: 100%; // 这个就是高的比例
position: relative;
}
.shopimg-info {
position: absolute;
top:0;
left: 0;
bottom: 0;
right: 0;
}
.shopimg img {
width: 100%;
height: 100%;
}
Vue中可以选择文字高亮的插件
npm install --save vue-text-highlightimport TextHighlight from ‘vue-text-highlight’;
Vue.component(‘text-highlight’, TextHighlight);<text-highlight :queries="queries">{{ description }}</text-highlight>
data() {
return {
queries: ['birds', 'scatt'],//需要高亮的文字
...
PostMan设置请求头
先设置一个环境变量登录接口做处理使用
粘贴图片 ctrl+v
document.addEventListener("paste", function (event) {
var isChrome = false;
if (event.clipboardData || event.originalEvent) {
//某些chrome版本使用的是event.originalEvent
var clipboardData =
event.clipboardData || event.originalEvent.clipboard...
JS判断是否为IE浏览器
function IEVersion() {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
var isEdge = userAgent.indexOf("Edge") > -1 ...
IE浏览器语法兼容
https://babeljs.io/en/repl.html
uni-app input问题
输入框输入如果不是 纯数字 或者 纯字母 你直接 输入 然后 不确认 的 话input 输入框 触发的 input 的 方法 报错安卓会有这个问题苹果不会 苹果中文输入法的话 不点击确定 那几个字符 你 直接 让 输入框 失焦的话 输入框的数据会 清空https://ask.dcloud.net.cn/question/115897 帖子地址
Vue相关开源项目库集合
https://github.com/hinesboy/awesome-github-vue
页面请求强制HTTPS
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
Vuex数据持久化 vuex-persistedstate
vuex-persistedstatevuex 的 state 只需要赋值 数据会自动记录到 localStorage,不需要你 手动 localStorage.setItem('key',value) 他会自动检测。逻辑使用数据结构
Swiper插件在Tab切换下切换失效
添加这两个属性
observer:true,
observeParents:true
获取github仓库目录
官网文档:https://docs.github.com/en/rest/reference/repos#get-repository-contentGET /repos/{owner}/{repo}/contents/{path}
owner:所有者
repo:仓库名字
path:路劲例子: https://api.github.com/repos/wozuinbs/video/contents/mini上述例子最多返回1000条数据。如需全部需要另外一种方法文档:https://docs.github.com/en/rest/referenc...
M3U8切片
使用ffmpeg./ffmpeg -i 源文件.mp4 -c copy -map 0 -f segment -segment_list ./m3u8位置 -segment_time 多少秒一个文件 ./切片位置./ffmpeg -i a.mp4 -c copy -map 0 -f segment -segment_list ./index.m3u8 -segment_time 30 ./vi-%04d.ts批量切片sh脚本目录结构
-z.sh
-ffmpeg
-test
--v 视频路劲
--f 切片的路劲for file in `ls ....
jsDelivr加载github文件
https://www.jsdelivr.com/ 官网可以用做图床和视频床仓库创建完成后,新建一个Releases输入一个版本号回车即可使用方法user:用户名repo:仓库名字@version :版本号 不写版本号默认最新例子:github: https://github.com/WishMelz/file/blob/master/css/characteristic.cssjsDelivr:https://cdn.jsdelivr.net/gh/WishMelz/file/css/characteristic.csspurge.jsdeli...
Element 设置不能选择今天以前的日期或以后的日期
<el-date-picker
:picker-options="pickerOptions0"
style="width: 200px"
v-model="poolData.targetTime"
type="datetime"
placeholder="设置截止时间"
value-for...
GitHub主页玩法
效果图如下,个人主页具体使用使用就是创建一个和自己用户名一样的创库。如下图其中README文件中的内容就是主要显示的内容。GitHub 统计卡片需要用到一个接口:https://github-readme-stats.vercel.app/api地址:https://github.com/anuraghazra/github-readme-stats {
let oInput = document.createElement("input");
oInput.value = val;
document.body.appendChild(oInput);
oInput.select();
document.execCommand("Copy");
this.$message({
message: "复制成功",
type: "success",
...