Immer 是一个 immutable 库,核心实现是利用 ES6 的 proxy,几乎以最小的成本实现了 js 的不可变数据结构,简单易用、体量小巧、设计巧妙,满足了我们对JS不可变数据结构的需求。无奈网络上完善的文档实在太少,所以自己写了一份,本篇文章以贴近实战的思路和流程,对 Im...
vue2/vue3 Composition Api 常用工具集, @vueuse/core 之核心函数 array 实践
useArrayDifference Reactive get array difference of two array <script lang="ts" setup> import { ref } from 'vue' import { useArrayDifference } from '@vueuse/core' const list1 = ref([0, 1, 2, 3, 4, 5]) const list2 = ref([4, 5, 6]) cons...
vue3.js 3.3.x 发布新特性之 defineModel
以前,为了使组件支持与v-model双向绑定,它需要(1)声明prop,(2)在打算更新prop时发出相应的update:propName事件: <script lang="ts" setup> const props = defineProps([ 'modelValue' ]) const emits = defineEmits(['update:modelValue']) const ...
vue3.js + vite + Typescript,使用过程中趟过的坑
defineModel() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect. defineModel()是一个编译器提示帮助器,只能在脚本setup单个文...
vue2/vue3 Composition Api 常用工具集, @vueuse/core 之核心函数 elements 实践
VueUse是一款基于组合式API的函数集合。 VueUse不是Vue.use,它是为Vue 2和3服务的一套Vue Composition API的常用工具集,是目前世界上Star最高的同类型库之一。它的初衷就是将一切原本并不支持响应式的JS API变得支持响应式,省去程序员自己写相关代码。 useActiveElem...
vue2/vue3 Composition Api 常用工具集, @vueuse/core 之核心函数 state 实践
VueUse是一款基于组合式API的函数集合。 VueUse不是Vue.use,它是为Vue 2和3服务的一套Vue Composition API的常用工具集,是目前世界上Star最高的同类型库之一。它的初衷就是将一切原本并不支持响应式的JS API变得支持响应式,省去程序员自己写相关代码。 createGlobalS...
element-ui table 组件等一些数据组件自定义render,存数据库方法如何快速转解码
在日常开发中,很多业务数据需求都是使用表格,列表去承载。开发人员首先想到的是制作各种公共组件。在开发中为了满足各种个性化自定义渲染,就会有这样的需求,把动态方法存到数据库,渲染时根据方法动态渲染数据。 这样问题来了,方法肯定不是直接往数据库里边存储,需要...
Mac Pro 安装 oh-my-zsh 后不执行~/.bash_profile、~/.bashrc 导致之前的配置好的zsh命令没法正常使用
刚使用MAC笔记本时间不长的小白,昨天在知乎上看到知友推荐 oh-my-zsh 比系统自带的zsh 工具更友好,忍不住就安装,确实主题蛮好的。 第二天起来想运行一个前端项目,发现node、nvm等命令都不能用了 提示:nvm command not found,查了很久资料终于找到的答案,就是昨晚...
Vue3 element-plus 中使用 sheetjs xlsx 导入导出 Excel
由SheetJS出品的js-xlsx是一款非常方便的只需要纯JS即可读取和导出excel的工具库,功能强大,支持格式众多,支持xls、xlsx、ods(一种OpenOffice专有表格文件格式)等十几种格式。本文全部都是以xlsx格式为例。 官方github:https://github.com/SheetJS/js-xlsx 安装模...
vite 常见报错解决集
Dynamic require of “path” is not supported 这里笔者使用的是最新版的 vite ^4.3.2 配置了项目的别名处理 const path = require('path') resolve: { alias: { '@': path.resolve(__dirname, 'src'), '@comp': path.resolve(__dirname, 'src/comp...