Commit 04fa10e1 authored by zhangderong's avatar zhangderong

节流

parent a9cbc267
...@@ -373,6 +373,7 @@ import qs from 'qs' ...@@ -373,6 +373,7 @@ import qs from 'qs'
import { import {
sapi sapi
} from '../../config' } from '../../config'
import{_debounce,_throttle} from '../../service/util.js'
import localStorage from '../../service/localstorage.service' import localStorage from '../../service/localstorage.service'
import Router from 'vue-router'; import Router from 'vue-router';
import ckeditor from '../../components/ckeditor' import ckeditor from '../../components/ckeditor'
...@@ -1331,21 +1332,30 @@ import ckeditor from '../../components/ckeditor' ...@@ -1331,21 +1332,30 @@ import ckeditor from '../../components/ckeditor'
this.uploadFileList=[] this.uploadFileList=[]
this.SouSuo(this.pageT) this.SouSuo(this.pageT)
}, },
getEditorValue(value){ // getEditorValue(value){
this.emailContent=value // this.emailContent=value
this.sad = value // this.sad = value
// if(this.sad==''){this.$Notice.error({ // // if(this.sad==''){this.$Notice.error({
// title: '提示', // // title: '提示',
// desc: '正文不能为空' // // desc: '正文不能为空'
// }); // // });
// } // // }
// if(this.emailContent==''){ // // if(this.emailContent==''){
// this.isDisable=false // // this.isDisable=false
// }else{ // // }else{
// this.isDisable=true // // this.isDisable=true
// } // // }
}, // },
getEditorValue: _debounce(() => {
this.emailContent=this.sad
this.sad = value
if(this.emailContent==''){
this.isDisable=false
}else{
this.isDisable=true
}
}),
delateFile(index){ delateFile(index){
this.fileList.splice(index,1) this.fileList.splice(index,1)
this.uploadFileList.splice(index,1) this.uploadFileList.splice(index,1)
......
...@@ -365,6 +365,7 @@ import {adoptOneSeeResumeList, serchList,downloadone,sousuoList,seedetail,PASS,O ...@@ -365,6 +365,7 @@ import {adoptOneSeeResumeList, serchList,downloadone,sousuoList,seedetail,PASS,O
import { import {
sapi sapi
} from '../../config' } from '../../config'
import{_debounce,_throttle} from '../../service/util.js'
import ckeditor from '../../components/ckeditor' import ckeditor from '../../components/ckeditor'
import localStorage from '../../service/localstorage.service' import localStorage from '../../service/localstorage.service'
export default { export default {
...@@ -1224,19 +1225,28 @@ export default { ...@@ -1224,19 +1225,28 @@ export default {
this.uploadFileList=[] this.uploadFileList=[]
this.SouSuo(this.pageT) this.SouSuo(this.pageT)
}, },
getEditorValue(value){ // getEditorValue(value){
this.emailContent=value // this.emailContent=value
// this.sad = value
// // if(this.emailContent==''){
// // this.isDisable=false
// // this.$Notice.error({
// // title: '提示',
// // desc: '请填写完整的信息'
// // });
// // }else{
// // this.isDisable=true
// // }
// },
getEditorValue: _debounce(() => {
this.emailContent=this.sad
this.sad = value this.sad = value
// if(this.emailContent==''){ if(this.emailContent==''){
// this.isDisable=false this.isDisable=false
// this.$Notice.error({ }else{
// title: '提示', this.isDisable=true
// desc: '请填写完整的信息' }
// }); }),
// }else{
// this.isDisable=true
// }
},
delateFile(index){ delateFile(index){
this.fileList.splice(index,1) this.fileList.splice(index,1)
this.uploadFileList.splice(index,1) this.uploadFileList.splice(index,1)
......
export function _debounce (fn, delay) {
let timer = null
delay = delay || 200
return function () {
let args = arguments
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(function () {
timer = null
fn.apply(this, args)
}.bind(this), delay)
}
}
export function _throttle (fn, interval) {
let last = null
let timer = null
interval = interval || 200
return function () {
let self = this
let args = arguments
let now = +new Date()
if (last && now - last < interval) {
clearTimeout(timer)
timer = setTimeout(function () {
last = now
fn.apply(self, args)
}, interval)
} else {
last = now
fn.apply(self, args)
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment