1。首先上传代码用户名:空,});//constrouter=useRouter();//constgoto_home=(()=>{//router.replace('/userList')//})constaffirm=()=>{console.log('enter')}watch(()=>state.username,(newValue,oldValue)=>{//直接监听console.log("Changed",newValue,oldValue,state);});return{确认,...toRefs(state)};},};这是监控的正确方式2.如果是监控所有watch(state,(newValue,oldValue)=>{//直接监控console.log("countchanged",newValue,旧值,状态);});newValue和oldValue是一样的(都是修改后的值)推荐方法一,这样可以监控修改前后的值
