代码作为验证
<template>
<div class="box">
<template class="box1" >
<div class="box2">
<h1 id="title">hello world!</h1>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
mounted() {
let box1 = document.querySelector(".box1")
console.log(box1)
let box2 = document.querySelector(".box2")
console.log("box2",box2)
}
}
</script>
<style lang="less" scoped>
.box1{
width: 500px;
height: 500px;
margin: 0 auto;
background-color: yellow;
}
</style>