至于未来会怎么样 反正路还长 天总会亮

Life is a journey, not a destination, care should be the scenery along the way and the mood to see the scenery.

个人博客
  • ...
     前端 浏览(27)  tangzihan ++阅读原文
    不要在watch或method里面使用箭头函数定义watcher或方法
    > 注意,不应该使用箭头函数来定义 watcher 函数 (例如 searchQuery: newValue => this.updateAutocomplete(newValue))。理由是箭头函数绑定了父级作用域的上下文,所以 this 将不会按照期望指向 Vue 实例,this.upd...
  • ...
     前端 浏览(29)  tangzihan ++阅读原文
    vue3组件的数据双向绑定
    第一步 在组件中向props添加`modelValue`属性 export default defineComponent({ props: { modelValue: String }, 在组件更新值的时候,发送一个`update:modelValue`的事件 {{inputRef.message}}...
  • ...
     前端 浏览(14)  tangzihan ++阅读原文
    Suspense异步请求组件
    通过Suspense我们可以方便的实现异步请求,加载前和加载后的效果 通常我们都要一个需求,当组件中的数据还在请求时,展示`loading`效果,当请求完毕时在展示正常的数据 之前这部分逻辑要我们自己定义,现在可以使用`...
  • ...
     前端 浏览(15)  tangzihan ++阅读原文
    Teleport
    Teleport 为什么要使用 Teleport? 老规矩,先来看一个需求 实现一个全局的`modal`组件,在所有组件通用 Modal.vue 确定要删除吗? import { defineComponent } from 'vue'; export defau...
  • ...
     前端 浏览(11)  tangzihan ++阅读原文
    Vue3模块化妙用初体验
    如下需求 当鼠标点击的时候,记录当前点击的坐标(x,y)用vue3实现 X:{{x}} Y:{{y}} import {ref,onMounted,onUnmounted} from 'vue'; export default { setup(){ const x = ref(0) const y...
  • ...
     前端 浏览(13)  tangzihan ++阅读原文
    从零开始搭建Vue工程
    项目骨架 object --dist --src ----assets ------images ------styles ----index.js ----app.vue --webpack.config.js dist目录存放编译后的资源 src存放源码文件 运行命令 `np...
  • ...
     前端 浏览(31)  tangzihan ++阅读原文
    vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
    原因 v15版的vue-loader配置需要加个VueLoaderPlugin ![](http://www.zihanzy.com/uploads/images/article_con/202012/22/article_con_1608627938_C8kDMinPDR.png) 解决办法 在webpack配置文件添加 const VueLoad...
  • ...
     前端 浏览(13)  tangzihan ++阅读原文
    手写Vue数据绑定
    小试牛刀 我们先来看如下vue实例有什么属性 var vm = new Vue({ el:' app', data:{ name:'hello', sex:1 } }) console.log(vm);...
  • ...
     前端 浏览(24)  tangzihan ++阅读原文
    Uncaught TypeError: Cannot assign to read only property 'exports' of object
    今天在进行vue服务端渲染的时候,出现如下错误 Uncaught TypeError: Cannot assign to read only property 'exports' of object ' ' 查了资料 “在webpack打包的时候,可以在js文件中混用require和export。但是不...
  • ...
     前端 浏览(27)  tangzihan ++阅读原文
    Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
    3