reactive

    • 示例
    1. <template>
    2. <div>
    3. <button @click="increase">被点击了{{obj.count}}次</button>
    4. </div>
    5. </template>
    6. import { createComponent, reactive } from '@vue/composition-api'
    7. export default createComponent({
    8. setup() {
    9. const obj = reactive({ count: 0 })
    10. const increase = () => {
    11. obj.count++
    12. return {
    13. obj,
    14. increase
    15. }
    16. }
    17. })
    18. </script>