滑动时页面警告
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
解决方法
* {
滑动时页面警告
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
解决方法
* {
function getGlobalThis () { | |
if (typeof self !== 'undefined') return self | |
if (typeof window !== 'undefined') return window | |
if (typeof global !== 'undefined') return global | |
// This may still return wrong result ⚠️ | |
if (typeof this !== 'undefined') return this | |
throw new Error('Unable to local global `this`') | |
} |
.msg { | |
animation: animeMsg 4.5s ease-in-out infinite; | |
} | |
@keyframes animeMsg { | |
0% { | |
opacity: 0; | |
} | |
50% { |
const loadImg = (img) => { | |
const isArray = Array.isArray(img) | |
if (!isArray) { | |
const oImg = new Image() | |
oImg.src = img | |
return new Promise(resolve => { | |
oImg.onload = () => { | |
resolve() | |
} | |
}) |
export function getImageSize (img: HTMLElement) { | |
const p = new Promise((resolve, reject) => { | |
if (img.natutralWidth) { | |
resolve({ width: img.naturalWidth, height: img.naturalHeight }) | |
} | |
const image = new Image() | |
image.onload = () => { | |
resolve({ width: image.width, height: image.height }) |
new Vue({ | |
data () { | |
return { | |
authSuccess: false | |
}; | |
}, | |
methods: { | |
goLogin () { | |
window.location.href = './login.html'; | |
} |
let lastTime = 0 | |
const prefixes = 'webkit moz ms o'.split(' ') // 各浏览器前缀 | |
let requestAnimationFrame | |
let cancelAnimationFrame | |
const isServer = typeof window === 'undefined' | |
if (isServer) { | |
requestAnimationFrame = function() { | |
return |
(function (doc, win) { | |
var body = doc.body; | |
var hasScrollTopChange = false; // 连续点击Input | |
var lastScrollTop = body.scrollTop; // 获取软键盘唤起时浏览器滚动部分的高度 | |
var scrollTimer = null; | |
$('input[type="text"], input[type="tel"], input[type="number"], input[type="password"], textarea') | |
.focus(function () { | |
// 获取焦点时触发 | |
clearInterval(scrollTimer); |
// simulate click event | |
const blob = new Blob([ '' ], { type: 'application/octet-stream' }) | |
const url = window.URL.createObjectURL(blob) | |
const save_link = document.createElement('a') | |
save_link.href = 'path_to_your_file/url' // | |
save_link.download = '[filename].[ext]' | |
const event = document.createEvent('MouseEvents') | |
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) | |
save_link.dispatchEvent(event) | |
window.URL.revokeObjectURL(url) |