摘要: 父组件 <template> <h3>父组件</h3> <div>{{ num }}</div> <div ref="box">使用ref获取dom</div> <div>watch监听数据-{{ watchVal }}</div> <about-view ref="child" :datas="n 阅读全文
posted @ 2023-03-27 16:42 Felix_Openmind 阅读(291) 评论(0) 推荐(0)
摘要: store.js //vuex import { createStore } from 'vuex' ​ export default createStore({ state: { num:1 }, mutations: { /** * @description: 修改num成新的num * @pa 阅读全文
posted @ 2023-03-27 16:41 Felix_Openmind 阅读(37) 评论(0) 推荐(0)
摘要: 在vue2中是使用this.refs.子组件名称.xxx方法,即可拿到子组件定义的值或者方法,在vue3中没办法这么拿取,必须子组件暴露后父组件才可以拿取到 //子组件 <template> <div class="child"> {{val}} </div> </template> <script 阅读全文
posted @ 2023-03-27 16:40 Felix_Openmind 阅读(719) 评论(0) 推荐(0)
摘要: //子组件 <template> <div class="child"> 我是子组件 </div> </template> <script setup> import {defineEmits,onMounted} from 'vue' const emit = defineEmits() onMo 阅读全文
posted @ 2023-03-27 16:40 Felix_Openmind 阅读(1263) 评论(0) 推荐(0)
摘要: 父元素传递给子元素的数据,子元素使用defineProps进行接收 //父元素 <template> <div class="box"> <!-- 子组件引用 --> <v-child msg='我给子元素带的一段话'></v-child> </div> </template> ​ ​ //子元素 阅读全文
posted @ 2023-03-27 16:39 Felix_Openmind 阅读(295) 评论(0) 推荐(0)
*{cursor: url(https://files-cdn.cnblogs.com/files/morango/fish-cursor.ico),auto;}