Answers for "vue computed composition api"

0

vue computed composition api

setup (props) {
    const repositories = ref([])

    const repositoriesMatchingSearchQuery = computed(() => {
      return repositories.value.filter(
        repository => repository.name.includes(searchQuery.value)
      )
    })
    
    return {repositories}
  }
Posted by: Guest on July-10-2021
1

vue composition api

<template>
  <button @click="increment">
    Count is: {{ state.count }}, double is: {{ state.double }}
  </button>
</template>

<script>
import { reactive, computed } from 'vue'

export default {
  setup() {
    const state = reactive({
      count: 0,
      double: computed(() => state.count * 2)
    })

    function increment() {
      state.count++
    }

    return {
      state,
      increment
    }
  }
}
</script>
Posted by: Guest on November-04-2020

Browse Popular Code Answers by Language