📃
Vucript Documentation
  • Vucript
  • Setup
  • Usage
  • Language Reference
    • Reactive Values & Functions
    • Computed
    • Lifecycle Methods
    • Import Components
    • Prop
    • Using Ohter Libraries
Powered by GitBook
On this page

Was this helpful?

  1. Language Reference

Computed

Computed in vue is used when you define computed values. You can define computed value easily.

let computedVariable:computed<type> = (()=>computeFormula)

Example

import { reactive,computed } from 'Vucript'
const counter:reactive<number> = 0;
const twiceTheCounter:computed<number> = (()=>counter*2);

This code is compiled to

import { defineComponent, ref, computed } from "vue";
export default defineComponent({
  setup() {
    const counter = ref<number>(0);
    const twiceTheCounter = computed(() => counter.value * 2);
    return { counter, twiceTheCounter };
  },
});

Like reactive, vucript automatically imports computed from Vue and returns computed value. It's so simple, isn't it?

PreviousReactive Values & FunctionsNextLifecycle Methods

Last updated 4 years ago

Was this helpful?