Tags add ref attribute, equivalent to id
In Vue acquired by property name $ refs.ref or set dom element
<div id="demo"> <@ the Click the Button = " the Fn " > Click here </ button> <div REF = " Box " style = " width: 200px; height: 300px by " > SWJTU </ div> </div> <script src="./node_modules/vue/dist/vue.js"></script> <script> new view ({ el: "#demo", data: { }, methods: { fn:function(){ console.log(this.$refs.box); console.log(this.$refs.box.innerText); console.log(this.$refs.box.style.width); this.$refs.box.style.backgroundColor="red" } } }) </script>