<script setup lang="ts">
import { function ref<T>(value: T): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T> (+1 overload)Takes an inner value and returns a reactive and mutable ref object, which
has a single property `.value` that points to the inner value.ref, const computed: {
<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
<T, S = T>(options: WritableComputedOptions<T, S>, debugOptions?: DebuggerOptions): WritableComputedRef<T, S>;
}
computed } from 'vue'
const const count: Ref<number, number>count = ref<number>(value: number): Ref<number, number> (+1 overload)Takes an inner value and returns a reactive and mutable ref object, which
has a single property `.value` that points to the inner value.ref(0)
const const double: ComputedRef<number>double = computed<number>(getter: ComputedGetter<number>, debugOptions?: DebuggerOptions): ComputedRef<number> (+1 overload)Takes a getter function and returns a readonly reactive ref object for the
returned value from the getter. It can also take an object with get and set
functions to create a writable ref object.computed(() => const count: Ref<number, number>count.Ref<number, number>.value: numbervalue * 2)
</script>
<script>
export default {
ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions>.name?: string | undefinedname: 'HelloWorld',
LegacyOptions<ToResolvedProps<{}, {}>, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, ComponentProvideOptions>.data?: ((this: CreateComponentPublicInstanceWithMixins<...>, vm: CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, ToResolvedProps<{}, {}>, {}, false, {}, {}, {}, {}, string, {}, any, ComponentProvideOptions, OptionTypesType<{}, {}, {}, {}, {}, {}>, Readonly<{}> & Readonly<{}>, {}, {}, {}, MethodOptions, {}>) => {
...;
}) | undefined
data() {
return {
msg: stringmsg: 'Hello!'
}
},
LegacyOptions<ToResolvedProps<{}, {}>, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, ComponentProvideOptions>.methods?: {
greet(): void;
} | undefined
methods: {
function greet(): voidgreet() {
var console: Consoleconsole.Console.log(...data: any[]): voidThe **`console.log()`** static method outputs a message to the console.
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)log(this.msg: stringmsg)
}
}
}
</script>
<template>
<button: ButtonHTMLAttributes & ReservedPropsbutton @onClick?: ((payload: PointerEvent) => void) | undefinedclick="const count: Ref<number, number>count++">{{ msg: stringmsg }} Count is: {{ const count: Ref<number, number>count }}</button: ButtonHTMLAttributes & ReservedPropsbutton>
</template>