原创 Vue項目中使用ant-design時設置DatePicker日期控件中文顯示

 默認配置爲 en-US,如果你需要設置其他語言,推薦在入口處使用提供的國際化組件,詳見:LocaleProvider 國際化。 方式一:在組件中單獨設置 import locale from 'antd/lib/date-picker

原创 JS刪除兩個數組中相同的某個對象值

var arr1=[{id:1},{id:2},{id:3},{id:4},{id:5}] var arr2=[{id:1},{id:2},{id:3}] var set=arr2.map(item=>item.id) console.

原创 微信小程序保存canvas繪製的圖片到本地

canvasToImage() { //  canvas畫布轉成圖片         var that = this;         wx.canvasToTempFilePath({             quality: 1,

原创 js過濾時間方法,幾分鐘前,1小時前

fifterTime(date){ let date1=date.replace(/-/g,"/"); let now = new Date().getTime(); let t = new Date(date1

原创 微信小程序下載圖片保存到本地

<image src="{{image}}" class="slide-image" mode="widthFix" bindload='imgHeight' data-url="{{image}}" bindlongpress="s

原创 微信小程序在組件中關閉小程序

<navigator target="miniProgram" open-type="exit" ></navigator>  

原创 微信小程序獲取用戶Ip地址

wx.request({ url: 'https://pv.sohu.com/cityjson?ie=utf-8', success(res){ var m = JSON.parse(res.dat

原创 JS刪除兩個數組有相同元素或者相同屬性

JS刪除兩個數組有相同元素或者相同屬性:  var newArray=array1.filter(function(item) { return array2.indexOf(item) == -1 });

原创 input 禁止輸入特殊字符

轉自:https://blog.csdn.net/u010982856/article/details/52297232 有些特殊字符傳入到後臺是會產生錯誤的  有可能會sql注入,所以從根本上攔截 研究了一下有幾種方式: 方式一:拿到v

原创 Vue自定義指令—— 完美解決H5頁面不同尺寸屏幕的適配問題

H5適配一直是一個頭疼的問題,基於vue框架針對H5在不同分辨率的手機做出來一套適配方案,具體如下: 設計圖按iPhone6/7/8 去掉底部返回條的尺寸設計的:  width:750px , height:1108px(可使用該方法應對

原创 vue中進入詳情頁記住列表滾動位置keep-alive解決

一、配置路由 keepactice:true { path: '/index', name: 'index', component: index, meta: {

原创 wangeditor中添加超鏈接校驗

在編輯器中添加鏈接必須添加以http://格式開頭的地址才能跳轉到外鏈地址 如果不加,就會帶入本域名地址,所以在需要設置一下: this.editor = new E('#editor'); this.editor.customCon

原创 input file 上傳圖片判斷圖片的寬高尺寸

最近的項目中有需要限制上傳圖片的尺寸: <form id="uploadForm"> <input type="file" id="file" @change="uploadImg($event)"> </form> 方法如下:

原创 vue-cli 外部引入vue-router報錯 Uncaught TypeError: Cannot redefine property: $router

在優化基於vue-cli開發的vue項目中,把vue-router改成外部引入的時候, 配置參數: externals: { 'vue': 'Vue', 'vue-router':'VueRouter', 'a

原创 Vue 打包後 vendor.js 體積太大,解決加載速度慢問題

原文鏈接:https://blog.csdn.net/LonewoIf/article/details/87777367 在 Vue 項目中,引入到工程中的所有 js、css 文件,編譯時都會被