10 2022 档案
Vue3 Composition API
摘要:一、响应式基础 前提:你会使用 setup 函数或 <script setup>语法 1.reactive 我们可以使用 reactive() 函数创建一个响应式对象或数组: import { reactive } from 'vue' const state = reactive({ count:
Vue3-CompositionAPI-响应式基础
摘要:一、响应式基础 前提:你会使用 setup 函数或 <script setup>语法 1.reactive 我们可以使用 reactive() 函数创建一个响应式对象或数组: import { reactive } from 'vue' const state = reactive({ count:
组件上的 v-model
摘要:💥💥💥 环境为:Vue3 1. 原生元素上的 v-model <p>{{ msg }}</p> <input v-model="msg" /> <!-- 上面的代码其实等价于下面这段 (编译器会对 v-model 进行展开): --> <input :value="msg" @input="m
Property 'style' does not exist on type 'Element' in TS
摘要:1.报错情况: 当前环境:TS 发生错误的实例: 原因: 通过document.getElementsByClassName函数返回的类型为HTMLCollectionOf<Element>,而Element类型上不存在style属性。需要通过**类型断言**设置正确的类型。 2. 解决 1.使用d