原创 取出2個數組裏面相同元素並生成新的數組

 let newArr = [];     for (let i = 0; i < arr2.length; i++) {         for (let j = 0; j < arr1.length; j++) {          

原创 圖片預加載(等圖片加載完了再展示頁面)

<template> <div class="home" v-if="finished"> <img :src="head" /> <div class="tab-box" ref="tabBG" :

原创 獲取N天后的日期

//獲取N天后的日期 GetDateStr(N) { //當前時間毫秒數 let dd = new Date().getTime(); //N天后的毫秒值 let SS = dd + 3600000 * 24 * N; //獲取N天后的毫

原创 背景圖不隨彈出框裏的文字滑動而滑動

bodyScrollLock.es6.js需提前下載 import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from "@/js/fn/bodySc

原创 vue在ie瀏覽器報錯

當報promise錯的時候   需要   import "babel-polyfill";

原创 判斷iphoneX XS XMAX

// iPhone X、iPhone XS var isIPhoneX = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && windo

原创 壓縮圖片 二維碼生成

壓縮圖片:https://tinypng.com/ 生成二維碼供移動端掃描:https://cli.im/text?ba52154e5d2e4eba465ddb6d84ebe115 草料二維碼  

原创 jquery.roundabout圖片3d自動輪播切換(比如:銀行卡切換)

引入: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <scr

原创 vue替換背景圖

html: <div class="tab-box" ref="tabBG" :style="tabImage"> <div class="tab tab1" @click="changeBG('1')"></d

原创 數字每3個加逗號,

//飛行公里數每3個字符加個逗號 parm3Flit(num) { let reg = ""; if (num) { if (num.indexOf(".") > -1) {

原创 IE不支持 Promise

1.引入 <script src = "https://cdn.polyfill.io/v2/polyfill.min.js"></script>  或 <script type="text/javascript" src ="https

原创 js操作session

session時使用sessionStorage . Storage表示存儲的意思。 一. 設置值 sessionStorage.setItem(key,value); 設置元素的值, setItem. 類似於服務器端的setAttr

原创 點擊事件阻止冒泡

event.stopPropagation();

原创 安卓微信瀏覽器頁面不刷新問題

應該在鏈接後面加上隨機數  就刷新了 setTimeout(() => { if (window.location.href.indexOf("?") != -1) { window.location.href = window.loca

原创 this.$router.push、replace、go

this.$router.push 跳轉到指定url路徑,並想history棧中添加一個記錄,點擊後退會返回到上一個頁面 // 字符串 this.$router.push('index')  // 對象 this.$router.push