vue3中watch同时监听多个值

watch(
    [() => state1.count, state2.value], ([newVal1, newVal2], [oldVal1, oldVal2]) => {
        console.log('watch监听中的newVal:', newVal1, newVal2);
        console.log('watch监听oldVal:', oldVal1, oldVal2);
    }
)

你可能感兴趣的:(前端,javascript,vue.js)