
获得徽章 16
来一个反直觉的Vue2代码:
```
// 组件定义参数:
valid: {
type: Boolean,
},
// 组件外部valid 不传,会输出什么
console.log(this.valid)
```
```
// 组件定义参数:
valid: {
type: Boolean,
},
// 组件外部valid 不传,会输出什么
console.log(this.valid)
```
展开
2
点赞
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
一直以为resolve就一定是让promise实例转变为fulfilled状态。其实不然,还是根据函数参数决定,和then函数中返回决定状态类似。
比如下面的例子:
new Promise(resolve => {
console.log(1)
resolve(Promise.reject(2))
}).then(res => {
console.log('then', res)
}).catch(res => {
console.log('catch', res)
})
比如下面的例子:
new Promise(resolve => {
console.log(1)
resolve(Promise.reject(2))
}).then(res => {
console.log('then', res)
}).catch(res => {
console.log('catch', res)
})
展开
5
1
赞了这篇沸点
vue3的响应式语法糖,虽然可以解决某些痛点,但调试时缺会让人误会。如下图,count和count1都是响应式,但是前者打印出来却是一个普通数据,后者打印出来是一个ref proxy。XDM,你们有类似的疑惑吗?
21
12