摘要: 方法: 1、父组件使用provide提供数据和修改数据的函数 2、后代组件使用inject接收数据并触发函数 完整代码: 1、App.vue 点击查看代码 <script setup> import{provide,ref}from 'vue' import myComponent from "./ 阅读全文
posted @ 2024-07-24 10:59 xjZhang 阅读(131) 评论(0) 推荐(0)
摘要: 注:Vue3版本 主要流程: 1、父组件向子组件传递监听事件 点击查看代码 <myComponent @getMessage="getMessage"/> 2、子组件使用emit机制添加要监听的事件 点击查看代码 const emit=defineEmits(['getMessage']) 3、子组 阅读全文
posted @ 2024-07-23 22:35 xjZhang 阅读(61) 评论(0) 推荐(0)
摘要: 使用ref函数和reactive函数写的技术器小程序,ref的实现用到了reactive,推荐使用ref,代码 点击查看代码 <script > //setup是组合是API的体现 import {reactive, ref} from 'vue' export default{ setup() { 阅读全文
posted @ 2024-07-22 22:27 xjZhang 阅读(33) 评论(0) 推荐(0)
摘要: 技术栈: 阅读全文
posted @ 2024-07-22 21:06 xjZhang 阅读(46) 评论(0) 推荐(0)
摘要: 生命周期就是vue创建dom流程中可调用的函数,共有八个: 1、beforeCreate:此时无法通过vm访问到data中的数据、methods中的方法; 2、created:可以通过vm访问到data中的数据、methods中配置的方法; 3、生成虚拟dom; 4、beforeMount:页面呈现 阅读全文
posted @ 2024-05-24 20:25 xjZhang 阅读(41) 评论(0) 推荐(0)
摘要: HTML+CSS的热词设计效果 代码: 点击查看代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-s 阅读全文
posted @ 2024-04-25 15:45 xjZhang 阅读(45) 评论(0) 推荐(0)
摘要: 效果说明:(1)当下拉滚动轴超过300px时,显示电梯导航 (2)点击返回顶部,立即返回顶部 点击查看代码 <body> <script> //效果说明(1)当下拉滚动轴超过300时,显示电梯导航 //(2)点击返回顶部,立即返回顶部 const elevator = document.queryS 阅读全文
posted @ 2024-04-17 22:29 xjZhang 阅读(97) 评论(0) 推荐(0)