最近总是遇到稀奇古怪的问题,明明定义的对象有属性值,还是报undefined
let states = reactive<statesTs>({
inputVisible: false,
inputValue: '',
tags:[]
});
// 点击添加标签的方法
const showInput = () => {
states.inputVisible = true;
nextTick(() => {
inputRef.value.focus();
})
};
// tag标签失去焦点之后添加的tags
const handleInputConfirm = () => {
console.log(states);
}
打印出来的states中的tags竟然是undefined,真的不能理解。最难受的是,我别的组件也有这样写的地方,但是没有问题
大家有遇到这样的情况吗?咋解决的呀