- 博客(10)
- 收藏
- 关注
原创 mac m1安装nvm
使用brew:brew install nvm查看~/目录下有没有.nvm文件夹,没有的话创建一个然后进入.nvm文件夹,创建.zshrc文件,写入如下指令即可:xport NVM_DIR="$HOME/.nvm" [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm [ -s "/opt/homebrew/opt/nvm/etc/bash_
2022-03-03 20:54:52 528 1
原创 vue3 element-plus 图片预览二次封装 全局函数式调用
由于官方没有提供全局使用的图片预览方法,所以进行一下封装方便使用// MyImageViewer.vue<template> <el-image-viewer v-if="isShow" :urlList="urlList" :zIndex="options.zIndex" :initialIndex="options.initialIndex" :infinite="options.infinite" :hideOnClickM
2022-01-24 17:19:06 1964
原创 vue3 setup中使用mapState hook封装
import { useStore, mapState } from 'vuex'import { computed } from 'vue'export function useState (mapper) { const store = useStore() const stateFunObj = mapState(mapper) const state = {} Object.keys(stateFunObj).forEach(funKey => { // bind.
2021-11-17 20:57:19 523
原创 简单的响应式实现
class Dep { constructor () { this.substribers = new Set() } // 收集依赖 depend () { if (activeEffect) { this.substribers.add(activeEffect) } } // 执行所有依赖 notify () { this.substribers.forEach((effect) => { effect() .
2021-11-12 15:27:01 107
原创 vue2和vue3组件使用v-model
vue2vue2组件使用v-model时相当于:value和@input,自组件通过props接收和$emit即可:// 子组件<template> <input type="text" v-model="valueC"></template><script>export default { props: { value: String, }, computed: { valueC: { get..
2021-11-03 21:53:36 543
原创 async await执行顺序
async await实际上是promise的语法糖new Promise((resolve, reject) => { //位置1 resolve()}).then(() => { //位置2})async function async1() { console.log('async1 start') await async2() console.log('async end')}async function async2() { console.lo
2021-09-21 00:07:53 201
原创 GET 请求URL拼接数组数据时发生错误解决
问题:拼接数组数据时会在数组数据属性的后面多拼接一个[]ps:?arr[]=1&arr[]=2解决:使用qs库yarn add qsaxios配置文件中配置请求拦截:const qs = require('qs')request.interceptors.request.use( config => { if (config.method === 'get') { config.paramsSerializer = function (para
2021-09-17 17:19:52 936
原创 js drop事件监听获取files值 在浏览器打印显示length为0的问题
该问题应该是浏览器bug,直接通过e.dataTransfer.files获取即可
2021-09-14 21:24:47 403 1
原创 node exports和module.exports的关系
在一个js文件中,如果没有对exports或moduole.exports进行赋值操作,那么两者就是相等的,因为两者指向同一块内存空间。如果被重新赋值,那么两者肯定就不一样了。 如果要对exports或module.exports进行赋值的话,那么我们肯定会对module.exports进行赋值操作,...
2021-09-11 23:53:43 61
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人