随笔分类 -  vue

摘要:这里fileChange第二个参数,不可也用fileList会污染已经定义的响应式变量fileList <script setup> const fileList = ref([]) const fileChange = (file,fileList) => { fileList.value = f 阅读全文
posted @ 2023-04-21 11:23 盘思动 阅读(91) 评论(0) 推荐(0)
摘要:Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or compute 阅读全文
posted @ 2023-04-18 09:07 盘思动 阅读(143) 评论(0) 推荐(0)
摘要:学习记录的一些博文: 1.https://www.cnblogs.com/goloving/p/16789607.html 都是一些最最基础的操作,实际场景比这个复杂 其中提到了pinia-plugin-persist 来持久化存储 2.https://www.cnblogs.com/yaopeng 阅读全文
posted @ 2023-04-12 10:36 盘思动 阅读(34) 评论(0) 推荐(0)
摘要:(1)vuex是什么?怎么使用?哪种功能场景使用它? vue框架中状态管理。在main.js引入store,注入。新建一个目录store,….. export 。场景有:单页应用中,组件之间的状态。音乐播放、登录状态、加入购物车 (2)vuex有哪几种属性? 有五种,分别是 State、 Gette 阅读全文
posted @ 2023-04-10 17:20 盘思动 阅读(48) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div 阅读全文
posted @ 2023-04-04 22:38 盘思动 阅读(23) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>v-for</title> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> < 阅读全文
posted @ 2023-04-04 16:18 盘思动 阅读(38) 评论(0) 推荐(0)
摘要:在 Vue.js 中,computed 是一种计算属性,它能够根据依赖的数据动态计算出一个新的值。 computed 属性可以定义为一个函数,该函数返回需要计算的值。 当它所依赖的数据发生变化时,Vue.js 会自动重新计算这个值并将其更新到组件上。 ### computed 与watch,meth 阅读全文
posted @ 2023-04-04 11:22 盘思动 阅读(37) 评论(0) 推荐(0)
摘要:这里msg的效果,在app.mount('#box')后就被覆盖掉了 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <div id="box"> 这里msg的效果,在app.mo 阅读全文
posted @ 2023-04-04 10:15 盘思动 阅读(134) 评论(0) 推荐(0)
摘要:var user = { id : 1, name : 'Tom', age : 10, school : 'primary school', sister:{ name:'Alice', age:12 } } var handler = { get(target,prop){ if(prop == 阅读全文
posted @ 2023-04-04 10:00 盘思动 阅读(38) 评论(0) 推荐(0)
摘要:在 Vue3 中,proxy 是一种新的 JavaScript 特性,用于创建一个代理对象,对代理对象的访问会通过 get 和 set 等方法拦截, 从而可以对代理对象进行一些自定义的处理逻辑。在 Vue3 中,我们可以使用 reactive 函数将一个普通对象转换成响应式对象, 而这个响应式对象就 阅读全文
posted @ 2023-04-03 09:32 盘思动 阅读(87) 评论(0) 推荐(0)
摘要:在vue3中可以通过app.config.globalProperties来挂载全局方法。 main.js const app = createApp(App) // 定义全局方法 const myGlobalMethod = () => { console.log('This is a globa 阅读全文
posted @ 2023-04-02 21:53 盘思动 阅读(3959) 评论(1) 推荐(1)