Commit 658e001d authored by nature's avatar nature

弹框修改

parent d7a8a4ef
This diff is collapsed.
...@@ -16,6 +16,8 @@ Vue.use(LoadingPlugin) ...@@ -16,6 +16,8 @@ Vue.use(LoadingPlugin)
Vue.use(DatetimePlugin) Vue.use(DatetimePlugin)
Vue.use(NumberKeyboard) Vue.use(NumberKeyboard)
import confirm from '../../components/Confirm/index'
// Vue.prototype.HlsModal = window.HlsModal = HlsModal // Vue.prototype.HlsModal = window.HlsModal = HlsModal
/** /**
...@@ -130,6 +132,22 @@ export function showError (content = '', time = 2000) { ...@@ -130,6 +132,22 @@ export function showError (content = '', time = 2000) {
* @param confirmObject.onConfirm 确定函数 * @param confirmObject.onConfirm 确定函数
*/ */
export function showConfirm (confirmObject) { export function showConfirm (confirmObject) {
let def = {
title: confirmObject.title || '提示',
content: confirmObject.content || '',
confirmText: '确定',
cancelText: '取消',
onConfirm: () => {
confirmObject.onConfirm(1)
},
onCancel: () => {
confirmObject.onConfirm(0)
},
}
confirm.confirmShow(def)
}
export function showConfirmVux (confirmObject) {
let def = { let def = {
title: confirmObject.title || '提示', title: confirmObject.title || '提示',
content: confirmObject.content || '', content: confirmObject.content || '',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
@import "animate"; @import "animate";
@import "variables"; @import "variables";
@import "ionic"; @import "ionic";
@import 'publicStyle'; @import 'public-style';
@import "ionic-public-style"; @import "ionic-public-style";
@import "platform-ios"; @import "platform-ios";
@import "platform-iosx"; @import "platform-iosx";
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
background: rgba(0, 0, 0, 0.3) !important; background: rgba(0, 0, 0, 0.3) !important;
} }
.weui-toast .weui-loading{ .weui-toast .weui-loading{
animation: vue-loading 1s steps(12, end) infinite !important; animation: vue-loading 1s steps(8, end) infinite !important;
background: transparent url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNTZweCIg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AgPC9nPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K) no-repeat;
background-size: 100%;
} }
.weui-loading_toast .weui-toast__content { .weui-loading_toast .weui-toast__content {
...@@ -43,7 +45,8 @@ ...@@ -43,7 +45,8 @@
.weui-toast { .weui-toast {
//width: 6em !important; //width: 6em !important;
min-width: 6em; min-width: 60px;
width: 65px !important;
max-width: 14em; max-width: 14em;
min-height: 3em !important; min-height: 3em !important;
top: 38% !important; top: 38% !important;
...@@ -65,13 +68,14 @@ ...@@ -65,13 +68,14 @@
} }
.weui-icon_toast.weui-loading { .weui-icon_toast.weui-loading {
width: 32px !important; width: 34px !important;
height: 32px !important; height: 34px !important;
} }
.weui-toast__content { .weui-toast__content {
//margin: 0 0 30px !important; font-size: 12px !important;
font-size: 14px !important; font-weight: 500;
margin: 10px 0 !important;
} }
.weui-toast_text .weui-toast__content { .weui-toast_text .weui-toast__content {
...@@ -121,6 +125,7 @@ ...@@ -121,6 +125,7 @@
} }
.weui-dialog { .weui-dialog {
height: fit-content;
width: 70% !important; width: 70% !important;
max-width: 260px !important; max-width: 260px !important;
border-radius: 10px !important; border-radius: 10px !important;
......
/**
* @Author think
* @Date 9/2/21 5:19 PM
*/
<template>
<div v-show="showValue" class="modal-backdrop" >
<section class="h-confirm">
<div v-if="!!title" class="confirm_hd">
<strong class="confirm__title">{{ title }}</strong>
</div>
<template v-if="showContent">
<div class="confirm__bd">
<slot><div v-html="content"/></slot>
</div>
</template>
<div class="confirm__ft vue-1px-t">
<a v-if="showCancelButton" href="javascript:;" class="confirm__btn confirm__btn_default" @click="_onCancel">{{ cancelText }}</a>
<a v-if="showConfirmButton" href="javascript:;" class="confirm__btn" @click="_onConfirm">{{ confirmText }}</a>
</div>
</section>
</div>
</template>
<script>
export default {
name: 'Confirm',
props: {
value: {
type: Boolean,
default: false,
},
title: {
type: String,
default: null,
},
content: {
type: String,
default: null,
},
showContent: {
type: Boolean,
default: true,
},
confirmText: {
type: String,
default: '确定',
},
cancelText: {
type: String,
default: '取消',
},
showCancelButton: {
type: Boolean,
default: true,
},
showConfirmButton: {
type: Boolean,
default: true,
},
},
data () {
return {
showValue: false,
}
},
watch: {
value (val) {
this.showValue = val
},
showValue (val) {
this.$emit('input', val)
this.$emit('on-show') // emit just after msg is cleared
},
},
created () {
if (this.value) {
this.showValue = this.value
}
},
methods: {
_onConfirm () {
let vm = this
vm.$emit('on-confirm')
this.showValue = false
},
_onCancel () {
let vm = this
vm.$emit('on-cancel')
vm.showValue = false
},
},
}
</script>
<style scoped lang="less">
.modal-backdrop{
z-index: 9999;
}
.h-confirm{
max-width: 80vw;
width: 75vw;
height: auto;
margin: auto;
background-color: #fff;
text-align: center;
border-radius: 8px;
.confirm_hd{
padding: 1.5em 1.6em .5em;
.confirm__title{
font-size: 16px;
}
}
.confirm__bd{
padding: 0 1.6em .8em;
min-height: 10.667vw;
font-size: 14px;
line-height: 1.3;
word-wrap: break-word;
word-break: break-all;
color: #999;
}
.confirm__ft{
display: flex;
position: relative;
line-height: 44px;
font-size: 16px
}
}
</style>
import ConfirmComponent from './confirm'
import Vue from 'vue'
import elementUtil from '../../common/scripts/elementUtil'
let $vm
const mergeOptions = function ($vm, options) {
const defaults = {}
for (let i in $vm.$options.props) {
if (i !== 'value') {
defaults[i] = $vm.$options.props[i].default
}
}
const _options = Object.assign({}, defaults, options)
for (let i in _options) {
$vm[i] = _options[i]
}
}
const confirm = {
install () {
elementUtil.createElement('hls-confirm')
$vm = new Vue(ConfirmComponent)
$vm.$mount('[hls-confirm]')
},
confirmShow (options) {
this.install()
setTimeout(() => {
if (typeof options === 'object') {
mergeOptions($vm, options)
}
if (typeof options === 'object' && (options.onShow || options.onHide)) {
options.onShow && options.onShow()
}
this.$watcher && this.$watcher()
this.$watcher = $vm.$watch('showValue', (val) => {
if (!val && options && options.onHide) {
options.onHide()
}
if (val === false) {
document.body.removeChild($vm.$el)
}
})
$vm.$off('on-cancel')
$vm.$off('on-confirm')
$vm.$on('on-cancel', () => {
options && options.onCancel && options.onCancel()
})
$vm.$on('on-confirm', msg => {
options && options.onConfirm && options.onConfirm(msg)
})
$vm.showValue = true
}, 100)
},
confirmHide () {
$vm.showValue = false
document.body.removeChild($vm.$el)
},
}
export default confirm
...@@ -29,9 +29,9 @@ export default { ...@@ -29,9 +29,9 @@ export default {
} }
}, },
update () { update () {
if (this.calContent) { // if (this.calContent) {
this.resizeHeight() // this.resizeHeight()
} // }
}, },
methods: { methods: {
getHeaderHeight () { getHeaderHeight () {
...@@ -40,19 +40,22 @@ export default { ...@@ -40,19 +40,22 @@ export default {
let headerHeight = 0 let headerHeight = 0
do { do {
if ($el) { if ($el) {
let elHeight = window.getComputedStyle($el).height // let elHeight = window.getComputedStyle($el).offsetHeight
let part = /^\d+(\.\d+)?px$/ headerHeight += $el.offsetHeight
/* let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) { if (elHeight && part.test(elHeight)) {
headerHeight += Number(elHeight.replace('px', '')) headerHeight += Number(elHeight.replace('px', ''))
} } else {
let paddingTopHeight = window.getComputedStyle($el).paddingTop headerHeight = elHeight
} */
/* let paddingTopHeight = window.getComputedStyle($el).paddingTop
let paddingBottomHeight = window.getComputedStyle($el).paddingBottom let paddingBottomHeight = window.getComputedStyle($el).paddingBottom
if (paddingTopHeight && part.test(paddingTopHeight)) { if (paddingTopHeight && part.test(paddingTopHeight)) {
headerHeight += Number(paddingTopHeight.replace('px', '')) headerHeight += Number(paddingTopHeight.replace('px', ''))
} }
if (paddingBottomHeight && part.test(paddingBottomHeight)) { if (paddingBottomHeight && part.test(paddingBottomHeight)) {
headerHeight += Number(paddingBottomHeight.replace('px', '')) headerHeight += Number(paddingBottomHeight.replace('px', ''))
} } */
$el = $el.previousElementSibling $el = $el.previousElementSibling
} }
} while ($el) } while ($el)
...@@ -67,28 +70,31 @@ export default { ...@@ -67,28 +70,31 @@ export default {
if (nextElement) { if (nextElement) {
let position = window.getComputedStyle(nextElement).position let position = window.getComputedStyle(nextElement).position
if (position !== 'fixed') { if (position !== 'fixed') {
let elHeight = window.getComputedStyle(nextElement).height // let elHeight = window.getComputedStyle(nextElement).offsetHeight
let part = /^\d+(\.\d+)?px$/ nextHeight += nextElement.offsetHeight
/* let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) { if (elHeight && part.test(elHeight)) {
nextHeight += Number(elHeight.replace('px', '')) nextHeight += Number(elHeight.replace('px', ''))
} } else {
//let paddingTopHeight = window.getComputedStyle(nextElement).paddingTop nextHeight = elHeight
//let paddingBottomHeight = window.getComputedStyle(nextElement).paddingBottom } */
//if (paddingTopHeight && part.test(paddingTopHeight)) { // let paddingTopHeight = window.getComputedStyle(nextElement).paddingTop
// let paddingBottomHeight = window.getComputedStyle(nextElement).paddingBottom
// if (paddingTopHeight && part.test(paddingTopHeight)) {
// nextHeight += Number(paddingTopHeight.replace('px', '')) // nextHeight += Number(paddingTopHeight.replace('px', ''))
//} // }
//if (paddingBottomHeight && part.test(paddingBottomHeight)) { // if (paddingBottomHeight && part.test(paddingBottomHeight)) {
// nextHeight += Number(paddingBottomHeight.replace('px', '')) // nextHeight += Number(paddingBottomHeight.replace('px', ''))
//} // }
} }
nextElement = nextElement.nextElementSibling nextElement = nextElement.nextElementSibling
} }
} while (nextElement) } while (nextElement)
return nextHeight return nextHeight
}, },
resizeHeight () { async resizeHeight () {
let vm = this let vm = this
this.$nextTick(() => { await this.$nextTick()
const headerHeight = vm.getHeaderHeight() const headerHeight = vm.getHeaderHeight()
const nextHeight = vm.getNextElementHeight() const nextHeight = vm.getNextElementHeight()
let windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight let windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
...@@ -101,7 +107,6 @@ export default { ...@@ -101,7 +107,6 @@ export default {
} }
let content = vm.$el let content = vm.$el
content.style.height = windowHeight - headerHeight - nextHeight + 'px' content.style.height = windowHeight - headerHeight - nextHeight + 'px'
})
}, },
}, },
} }
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
*/ */
<template> <template>
<div ref="scroll" :class="[c(),{'h-ios': isIos}]" class="content scroll-content"> <div ref="scroll" :class="[c(),{'h-ios': isIos}]">
<div :class="c('__wrapper')"> <div :class="c('__wrapper')">
<div ref="scrollContent" class="scrollContent"> <div ref="scrollContent" class="scrollContent">
<slot/> <slot/>
...@@ -224,7 +223,7 @@ export default { ...@@ -224,7 +223,7 @@ export default {
this.fullScreen && detectOS() === 'ios' && (this.isIos = true) this.fullScreen && detectOS() === 'ios' && (this.isIos = true)
}, },
async mounted () { async mounted () {
this.pullDownInitTop = parseInt(this.$refs.pulldown && getComputedStyle(this.$refs.pulldown).top) || -60 this.pullDownInitTop = parseInt(this.$refs.pulldown && getComputedStyle(this.$refs.pulldown).top) || -10
await this.$nextTick() await this.$nextTick()
this.initScroll() this.initScroll()
...@@ -242,19 +241,20 @@ export default { ...@@ -242,19 +241,20 @@ export default {
let headerHeight = 0 let headerHeight = 0
do { do {
if ($el) { if ($el) {
let elHeight = window.getComputedStyle($el).height headerHeight += vm.$el.offsetHeight
/* let elHeight = window.getComputedStyle($el).height
let part = /^\d+(\.\d+)?px$/ let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) { if (elHeight && part.test(elHeight)) {
headerHeight += Number(elHeight.replace('px', '')) headerHeight += Number(elHeight.replace('px', ''))
} }
let paddingTopHeight = window.getComputedStyle($el).paddingTop let marginTopHeight = window.getComputedStyle($el).marginTop
let paddingBottomHeight = window.getComputedStyle($el).paddingBottom let marginBottomHeight = window.getComputedStyle($el).marginBottom
if (paddingTopHeight && part.test(paddingTopHeight)) { if (marginTopHeight && part.test(marginTopHeight)) {
headerHeight += Number(paddingTopHeight.replace('px', '')) headerHeight += Number(marginTopHeight.replace('px', ''))
}
if (paddingBottomHeight && part.test(paddingBottomHeight)) {
headerHeight += Number(paddingBottomHeight.replace('px', ''))
} }
if (marginBottomHeight && part.test(marginBottomHeight)) {
headerHeight += Number(marginBottomHeight.replace('px', ''))
} */
$el = $el.previousElementSibling $el = $el.previousElementSibling
} }
} while ($el) } while ($el)
...@@ -268,20 +268,21 @@ export default { ...@@ -268,20 +268,21 @@ export default {
do { do {
if (nextElement) { if (nextElement) {
let position = window.getComputedStyle(nextElement).position let position = window.getComputedStyle(nextElement).position
if (position === 'fixed') { if (position !== 'fixed') {
let elHeight = window.getComputedStyle(nextElement).height nextHeight += vm.$el.offsetHeight
/* let elHeight = window.getComputedStyle(nextElement).height
let part = /^\d+(\.\d+)?px$/ let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) { if (elHeight && part.test(elHeight)) {
nextHeight += Number(elHeight.replace('px', '')) nextHeight += Number(elHeight.replace('px', ''))
} }
let paddingTopHeight = window.getComputedStyle(nextElement).paddingTop let marginTopHeight = window.getComputedStyle(nextElement).marginTop
let paddingBottomHeight = window.getComputedStyle(nextElement).paddingBottom let marginBottomHeight = window.getComputedStyle(nextElement).marginBottom
if (paddingTopHeight && part.test(paddingTopHeight)) { if (marginTopHeight && part.test(marginTopHeight)) {
nextHeight += Number(paddingTopHeight.replace('px', '')) nextHeight += Number(marginTopHeight.replace('px', ''))
}
if (paddingBottomHeight && part.test(paddingBottomHeight)) {
nextHeight += Number(paddingBottomHeight.replace('px', ''))
} }
if (marginBottomHeight && part.test(marginBottomHeight)) {
nextHeight += Number(marginBottomHeight.replace('px', ''))
} */
} }
nextElement = nextElement.nextElementSibling nextElement = nextElement.nextElementSibling
} }
...@@ -292,13 +293,14 @@ export default { ...@@ -292,13 +293,14 @@ export default {
initScroll () { initScroll () {
let vm = this let vm = this
if (!this.$refs.scroll) return if (!this.$refs.scroll) return
const headerHeight = vm.getHeaderHeight()
const nextHeight = vm.getNextElementHeight()
this.$refs.scroll.style.height = `${this.$refs.scroll.getBoundingClientRect().height - headerHeight - nextHeight}px`
// 设置scrollContent的最小高,实现高度不足时也有回弹效果 // 设置scrollContent的最小高,实现高度不足时也有回弹效果
if (this.$refs.scrollContent) { if (this.$refs.scrollContent) {
const headerHeight = vm.getHeaderHeight()
// const nextHeight = vm.getNextElementHeight() // const nextHeight = vm.getNextElementHeight()
this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height + 1}px` this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height}px`
this.$refs.scrollContent.style.paddingTop = `${headerHeight}px` // this.$refs.scrollContent.style.paddingTop = `${headerHeight}px`
if (vm.hasFoot.footFlag) { if (vm.hasFoot.footFlag) {
let height = vm.hasFoot.height || 88 let height = vm.hasFoot.height || 88
// this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height - height}px` // this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height - height}px`
...@@ -473,8 +475,8 @@ export default { ...@@ -473,8 +475,8 @@ export default {
width 100% width 100%
overflow hidden !important overflow hidden !important
box-sizing border-box box-sizing border-box
position absolute position relative
top 0 //top 0
height 100% height 100%
&__wrapper { &__wrapper {
...@@ -505,6 +507,7 @@ export default { ...@@ -505,6 +507,7 @@ export default {
position absolute position absolute
left 0 left 0
top 0; /*no*/ top 0; /*no*/
z-index -5
width 100% width 100%
display flex display flex
justify-content center justify-content center
...@@ -535,7 +538,7 @@ export default { ...@@ -535,7 +538,7 @@ export default {
.platform-ios{ .platform-ios{
.vue-better-scroll{ .vue-better-scroll{
&__pulldown { &__pulldown {
padding-top:4px //padding-top:4px
} }
} }
.has-footer { .has-footer {
...@@ -549,7 +552,7 @@ export default { ...@@ -549,7 +552,7 @@ export default {
.platform-ios { .platform-ios {
.vue-better-scroll{ .vue-better-scroll{
&__pulldown { &__pulldown {
padding-top:24px //padding-top:24px
} }
} }
.has-footer { .has-footer {
...@@ -565,7 +568,7 @@ export default { ...@@ -565,7 +568,7 @@ export default {
.platform-ios { .platform-ios {
.vue-better-scroll{ .vue-better-scroll{
&__pulldown { &__pulldown {
padding-top:24px //padding-top:24px
} }
} }
.has-footer { .has-footer {
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ import NumberKeyboardPlugin from './components/NumberKeyboard/index' ...@@ -42,7 +42,7 @@ import NumberKeyboardPlugin from './components/NumberKeyboard/index'
// styles // styles
import appStyle from './common/styles/app.core.less' import appStyle from './common/styles/app.core.less'
import {showLoading, hideLoading, showLongTop, showLongCenter, showLongBottom, showSuccess, showError, showConfirm, showPopup, showActionSheet, showTime, showBigPicture, selectList, showNumberKeyboard, showNotify} from './common/scripts/hlsPopup' import {showLoading, hideLoading, showLongTop, showLongCenter, showLongBottom, showSuccess, showError, showConfirm, showConfirmVux, showPopup, showActionSheet, showTime, showBigPicture, selectList, showNumberKeyboard, showNotify} from './common/scripts/hlsPopup'
import elementUtil from './common/scripts/elementUtil' import elementUtil from './common/scripts/elementUtil'
import filter from './common/scripts/filter' import filter from './common/scripts/filter'
import directives from './common/scripts/directives' import directives from './common/scripts/directives'
...@@ -59,6 +59,7 @@ const hlsPopup = { ...@@ -59,6 +59,7 @@ const hlsPopup = {
showSuccess, showSuccess,
showError, showError,
showConfirm, showConfirm,
showConfirmVux,
showPopup, showPopup,
showActionSheet, showActionSheet,
showTime, showTime,
......
...@@ -68,7 +68,6 @@ export default { ...@@ -68,7 +68,6 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
@import "../packages/common/styles/publicStyle";
html, body, #app { html, body, #app {
height: 100%; height: 100%;
width: 100%; width: 100%;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<h-button class="button-class" type="primary" @click.native="showSuccess">showSuccess</h-button> <h-button class="button-class" type="primary" @click.native="showSuccess">showSuccess</h-button>
<h-button class="button-class" type="primary" @click.native="showError">showError</h-button> <h-button class="button-class" type="primary" @click.native="showError">showError</h-button>
<h-button class="button-class" type="primary" @click.native="showConfirm">showConfirm</h-button> <h-button class="button-class" type="primary" @click.native="showConfirm">showConfirm</h-button>
<h-button class="button-class" type="primary" @click.native="showConfirmVux">showConfirmVux</h-button>
<h-button class="button-class" type="primary" @click.native="showPopup">showPopup</h-button> <h-button class="button-class" type="primary" @click.native="showPopup">showPopup</h-button>
<h-button class="button-class" type="primary" @click.native="showActionSheet">showActionSheet</h-button> <h-button class="button-class" type="primary" @click.native="showActionSheet">showActionSheet</h-button>
<h-button class="button-class" type="primary" @click.native="showActionSheetButton">showActionSheet 区分按钮颜色 <h-button class="button-class" type="primary" @click.native="showActionSheetButton">showActionSheet 区分按钮颜色
...@@ -348,7 +349,7 @@ export default { ...@@ -348,7 +349,7 @@ export default {
}).then((modal) => { }).then((modal) => {
this.modal = modal; this.modal = modal;
}) */ }) */
this.$refs.scrollList.update(true) // this.$refs.scrollList.update(true)
}, },
methods: { methods: {
scrollListen (e) { scrollListen (e) {
...@@ -391,7 +392,7 @@ export default { ...@@ -391,7 +392,7 @@ export default {
// console.log(`change: ${i}`) // console.log(`change: ${i}`)
}, },
showLoading () { showLoading () {
this.hlsPopup.showLoading('请稍等!') this.hlsPopup.showLoading('请稍等!', 3000000)
}, },
hideLoading () { hideLoading () {
this.hlsPopup.hideLoading() this.hlsPopup.hideLoading()
...@@ -420,6 +421,15 @@ export default { ...@@ -420,6 +421,15 @@ export default {
}, },
}) })
}, },
showConfirmVux () {
this.hlsPopup.showConfirmVux({
title: '确定退出',
content: '退出后需从新登录',
onConfirm: function (index) {
alert(index)
},
})
},
showPopup () { showPopup () {
this.hlsPopup.showPopup({ this.hlsPopup.showPopup({
title: '确定退出', title: '确定退出',
......
...@@ -113,8 +113,8 @@ export default { ...@@ -113,8 +113,8 @@ export default {
height: '', height: '',
decimal: false, decimal: false,
rangeValue: 40, rangeValue: 40,
min: 20, min: 0,
max: 80, max: 100,
step: 10, step: 10,
disabled: false, disabled: false,
disabledOpacity: 0.5, disabledOpacity: 0.5,
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script src="https://common.cnblogs.com/scripts/jquery-2.2.0.min.js?callback=callbask">
function queryInfo(){
let obj={
name:'zhangsan',
age:'14'
}
callbask(obj)
}
</script>
<body style="height: 3000px">
<input>
</body>
<script>
function callbask(res){
console.log(res)
}
let input = document.querySelector('input')
let timeid = null
/*input.oninput=function(){
console.log(this.value)
}*/
/*input.oninput=function(){
//todo
if(timeid){
clearTimeout(timeid)
}
timeid = setTimeout(()=>{
//todo
/!*search();
submit()*!/
console.log(this.value)
},500)
}*/
input.oninput=debounce(function(){
console.log(this.value)
},500)
function debounce(fun,await){
let timeid = null
return function () {
if (timeid) {
clearTimeout(timeid)
}
timeid = setTimeout(()=>{
fun.apply(this)
}, await)
}
}
function throttle(fun,await) {
let timeid = null
return function () {
if (!timeid) {
timeid = setTimeout(() => {
fun.apply(this)
timeid=null
}, await)
}
}
}
/*window.onscroll=function(){
console.log('页面滚动')
}*/
let timeOutId=null
/*window.onscroll=function(){
if(!timeOutId){
timeOutId = setTimeout(()=>{
console.log('页面滚动')
timeOutId=null
},500)
}
}*/
window.onscroll=throttle(function(){
console.log('页面滚动')
},500)
let age = Object.freeze()
/* function debounce(func, wait=0) {
let timeid = null;
return function() {
let args = arguments;
if (timeid) {
clearTimeout(timeid);
}
timeid = setTimeout(()=> {
func.apply(this, args);
}, wait);
}
}
function throttle(func, delay) {
let timer = null;
return function() {
var args = arguments;
if (!timer) {
timer = setTimeout(()=> {
func.apply(this, args);
timer = null;
}, delay);
}
}
}*/
</script>
</html>
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