Vue practice thirty-nine: 05_04_ prevent the default event

Demo online address:
https://sx00xs.github.io/test/39/index.html
----------------------------- ----------------------------------
IDE: VSCode
file formats: .vue
resolve to be completed :()

<template>
    <pre v-pre>
&lt;script type="text/javascript"&gt;
<span>//※oncontextmenu</span>
document.oncontextmenu = function ()
{
    return false
}
&lt;/script&gt;
    </pre>
</template>
<script>
export default {
    name:'Navs',
    methods:{
        handleContextmenu(event){
            event.preventDefault()
        }
    },
    mounted(){
        document.addEventListener('contextmenu',this.handleContextmenu)
    }
}
</script>

 

Guess you like

Origin www.cnblogs.com/sx00xs/p/11266238.html