提交 d6c645c2 编写于 作者: B big_sun_962464

Thu Jun 20 22:29:00 CST 2024 inscode

上级 79c5bd79
<script setup> <script setup>
import HelloWorld from './components/HelloWorld.vue' import {ref,reactive,shallowRef} from 'vue'
import TheWelcome from './components/TheWelcome.vue' const obj = shallowRef({
</script> level:1,
grandFather:{
<template> level:2,
<header> father:{
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" /> level:3,
son:{
level:4,
grandSon:{
level:5,
name:'grandSon'
}
}
}
}
})
<div class="wrapper"> const count = ref(1)
<HelloWorld msg="You did it!" /> const obj1 = reactive({
</div> count
</header> })
<main> const books = reactive([
<TheWelcome /> ref('vue3.0')
</main> ])
</template>
<style scoped> console.log(books[0].value)
header {
line-height: 1.5;
}
.logo { function changeGrandFather(){
display: block; obj.value.level = 2
margin: 0 auto 2rem;
} }
</script>
@media (min-width: 1024px) { <template>
header { <div>
display: flex; {{count}}-{{obj1}}-{{books}}
place-items: center; <button @click="obj1.count = 2"></button>
padding-right: calc(var(--section-gap) / 2); <pre>{{obj}}</pre>
} <!-- {{obj}} -->
<hr/>
<button @click="obj={name:'obj'}">obj</button>
<button @click="obj.level++">changeGrandFather</button>
<button @click="obj.grandFather.level++">changeFather</button>
<button @click="obj.grandFather.father.level++">changeSon</button>
<button @click="obj.grandFather.father.son.level++">changeGrandSon</button>
<button @click="obj.grandFather.father.son.grandSon.level++">lastLevel</button>
<button @click="obj.name='grandFather'">+grandFather</button>
<button @click="obj.grandFather.name = 'father'">+father</button>
<button @click="obj.grandFather.father.name = 'son'">+son</button>
<button @click="obj.grandFather.father.son.grandSon.age = 12">++</button>
</div>
</template>
.logo { <style scoped>
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册