Commit aa635d01 authored by mzx's avatar mzx

防抖

parent 54257f08
......@@ -62,6 +62,19 @@ Vue.use(BaiduMap, {
// ak: 'kxwhR8fCOkjo0POcbaCAtd26crgre60O' // 这个地方是官方提供的ak密钥
ak: 'mFcxU7KZm0ZqALwPXCKr7s62Q4aK5IGd' // 这个地方是官方提供的ak密钥
})
// 提交以后禁用按钮一段时间,防止重复提交
Vue.directive('noMoreClick', {
inserted(el, binding) {
el.addEventListener('click', e => {
el.classList.add('is-disabled')
el.disabled = true
setTimeout(() => {
el.disabled = false
el.classList.remove('is-disabled')
}, 2000)// 设置2000毫秒也就是2秒
})
}
})
Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
......
......@@ -173,7 +173,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-if="!disabledon" type="primary" @click="submitForm"> </el-button>
<el-button v-if="!disabledon" type="primary" v-no-more-click @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
......
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