![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TypeScript
qwe122343
这个作者很懒,什么都没留下…
展开
-
Vue3 TypeScript 子传父 emit 的使用
和 Vue2 子传父案例简单入门 相比,Vue 3 子传父的 emit 使用略有不同,同样 通过 Father.vue 和 Child.vue 展示首先是 Child.vue,重点在 setup 函数中引入 context 形参,配合 emit 使用。定义了两个函数,toFatherNum(), toFatherObject() 分别向父组件传递数字和对象<template> <a-button @click="toFatherNum">子传父数字</a-button&原创 2021-04-24 10:30:17 · 4857 阅读 · 0 评论 -
TS2532: Object is possibly ‘undefined‘
TypeScript 的规矩很多,用起来很是严谨。定义了一个函数的接口,参数 x, y, z ( z可选 ) 均为number,返回值为 number 类型interface AddFunction22 { (x: number, y: number, z?: number): number;}const add3333: AddFunction22 = (x, y, z) => x + y + z;console.log(add3333(23, 546, 67));然后就报错:原创 2021-04-07 11:56:12 · 13723 阅读 · 0 评论