SoFunction
Updated on 2025-04-09

vue implements the function of prohibiting selection of page content, only input boxes and text fields are optional

I searched online and found two ways

CSS style control, just copy the following code to the body tag in the vue application

*{ 
 -webkit-touch-callout:none; /*The system default menu is disabled*/ 
 -webkit-user-select:none; /*webkit browser*/ 
 -khtml-user-select:none; /*Early browsers*/ 
 -moz-user-select:none;/*Firefox*/ 
 -ms-user-select:none; /*IE10*/ 
 user-select:none; 
} 
input{ 
 -webkit-user-select:auto; /*webkit browser*/  
}
textarea{
 -webkit-user-select:auto; /*webkit browser*/
}

js control method,Onselect start(), onselect need to be rewrite. (Just copy the following code to the body tag. Note that this writing method is also not optional.)

onselectstart='return false'
onselect='return false'
oncontextmenu='return false' #This sentence disables the right mouse button

The above article vue implements the function of prohibiting selection of page content. Only the input box and text field are optional is all the content I share with you. I hope you can give you a reference and I hope you can support me more.