摘要: 1.优化if判断 2.非空判断?? 如果??左侧为undefined或者null时才会返回右侧的值 ES5方式:if(value !== null && value !== undefined && value !== ''){//……} ES6方式:if ((value ?? '') !== '' 阅读全文
posted @ 2023-04-20 08:36 AAAqingqing 阅读(50) 评论(0) 推荐(0)
摘要: 所有数据绑定都支持js表达式(每个绑定都只能包含单个表达式) {{num+1}}或<p :bind="'list'+id"></p> 动态参数 动态参数表达式有一些语法约束,因为某些字符,如空格和引号,放在 HTML attribute 名里是无效的。(计算属性代替) <input @[type?u 阅读全文
posted @ 2022-03-27 21:55 AAAqingqing 阅读(26) 评论(0) 推荐(0)
摘要: 组合式 API 模板引用在 v-for 内部使用时没有特殊处理。需要绑定函数自定义处理。 <template> <div v-for="(item, i) in list" :ref="el => { if (el) divs[i] = el }"> {{ item }} </div> </temp 阅读全文
posted @ 2022-03-18 11:01 AAAqingqing 阅读(702) 评论(0) 推荐(0)
摘要: 1.reactive()--参数必须是对象(json/arr) reactive是一个函数,它可以定义一个复杂数据类型,成为响应式数据。 将数据响应化 toRef()函数,转换响应式对象中某个属性为单独响应式数据,并且值是关联的。 优化访问,去除前缀(某一个属性) toRefs()函数,转换响应式对 阅读全文
posted @ 2022-03-15 23:17 AAAqingqing 阅读(3247) 评论(0) 推荐(0)
摘要: 1.vue的引入方式 vue2 import Vue from 'vue' .......完整写法:import Vue from "../node_modules/vue/dist/vue.js"; vue3 import { createApp } from 'vue' vue通过createA 阅读全文
posted @ 2022-03-15 10:54 AAAqingqing 阅读(224) 评论(0) 推荐(0)