Vue3中computed() 的全面用法(简单易懂,一篇就会)

1: 引入

import  { computed }  from  'vue' 

2:使用

 let  price =  ref(10);
 let  amount = ref(3);
 let  total = computed( ()=>{
    return price.value*amount.value
 })

或者

const initSearchData = ref (

       [ {

                value: computed(() => objectNo.value).value

        }, ]

)

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