mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 09:27:19 +08:00
2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{m as V}from"./message-7116a117.js";import{f as n,O as d}from"./index-8c77f9cd.js";const a=Vue.createElementVNode("div",null,"防抖:debounce",-1),s=Vue.createElementVNode("div",{class:"mb-5"}," 所谓防抖,就是指触发事件后在 n 秒内函数只能执行一次,如果在 n 秒内又触发了事件,则会重新计算函数执行时间。 ",-1),r=Vue.createElementVNode("div",null,"节流:throttle",-1),i=Vue.createElementVNode("div",{class:"mb-5"}," 所谓节流,就是指连续触发事件但是在 n 秒中只执行一次函数。节流会稀释函数的执行频率。 ",-1),_=Vue.defineComponent({name:"Debounce"}),x=Vue.defineComponent({..._,setup(m){const e=()=>V("恭喜你,这是一条成功消息",{type:"success"}),u=n(e,1e3,!0),c=n(e,1e3),l=d(e);return(C,h)=>{const t=Vue.resolveComponent("el-button"),o=Vue.resolveComponent("el-card");return Vue.openBlock(),Vue.createElementBlock("div",null,[Vue.createVNode(o,{class:"mb-5"},{header:Vue.withCtx(()=>[a]),default:Vue.withCtx(()=>[s,Vue.createVNode(t,{onClick:Vue.unref(u)},{default:Vue.withCtx(()=>[Vue.createTextVNode(" 连续点击我,只会执行第一次点击事件,立即执行 ")]),_:1},8,["onClick"]),Vue.createVNode(t,{onClick:Vue.unref(c)},{default:Vue.withCtx(()=>[Vue.createTextVNode(" 连续点击我,只会执行最后一次点击事件,延后执行 ")]),_:1},8,["onClick"])]),_:1}),Vue.createVNode(o,null,{header:Vue.withCtx(()=>[r]),default:Vue.withCtx(()=>[i,Vue.createVNode(t,{onClick:Vue.unref(l)},{default:Vue.withCtx(()=>[Vue.createTextVNode(" 连续点击我,每一秒只会执行一次点击事件 ")]),_:1},8,["onClick"])]),_:1})])}}});export{x as default};
|