摘要:
1、概念 轻量化的ref函数和reactive函数,只能进行一层响应式 2、对比 a、shallowRef和ref ref响应式的,可以是基本数据类型和对象,当是对象时,ref会借助reactive生产proxy,实现数据响应式 shallowRef,只能对基本数据类型进行响应式处理 b、shall 阅读全文
posted @ 2025-01-10 13:39
市丸银
阅读(89)
评论(0)
推荐(0)
摘要:
一、作用 简化模板{{xx}},xx的长度 二、toRef 1、语法 toRef(对象,属性) 2、案例 <template> <h2>姓名:{{ name }}</h2> <h2>年龄:{{ age }}</h2> <h2>工资:{{ salary }}</h2> <button @click=" 阅读全文
posted @ 2025-01-10 11:51
市丸银
阅读(71)
评论(0)
推荐(0)
摘要:
1、优点 代码功能模块化,复用代码 2、建立 新建hooks文件夹,在src下 src/hooks/use功能.js 3、案例 a、模块化 src/hooks/usepoint.js import { reactive, onMounted, onBeforeUnmount} from 'vue'; 阅读全文
posted @ 2025-01-10 11:05
市丸银
阅读(48)
评论(0)
推荐(0)
摘要:
vue.config.js const { defineConfig } = require('@vue/cli-service') const {DefinePlugin} = require('webpack') module.exports = defineConfig({ transpile 阅读全文
posted @ 2025-01-10 10:14
市丸银
阅读(310)
评论(0)
推荐(0)
摘要:
一、引入 ,写在setup里面 import {onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount, onUnmounted} from 'vue'; 二、与Vue2的关系 setup() > beforecrea 阅读全文
posted @ 2025-01-10 10:06
市丸银
阅读(72)
评论(0)
推荐(0)
摘要:
1、watch:既要指明监视的属性,也要指明监视的回调 2、watchEffect:不要指明监视的属性,监视的回调用哪个属性,就监视哪个属性 3、语法 a、引入 import { watchEffect } from 'vue'; b、使用 // 不用指明监视属性,监视回调中使用的属性 watchE 阅读全文
posted @ 2025-01-10 08:41
市丸银
阅读(47)
评论(0)
推荐(0)

浙公网安备 33010602011771号