UNPKG

@wikimedia/wvui

Version:

Wikimedia Vue UI (WVUI) – Wikimedia Foundation's Vue.js shared user-interface components for Wikipedia, MediaWiki, and beyond.

23 lines (22 loc) 1.09 kB
import { WritableComputedRef, Ref } from '@vue/composition-api'; export declare type ModelValue = string | number | boolean | unknown[]; /** * Provide a computed property that models an input value. * * This is useful when setting v-model on a component, which then needs to set * v-model on an input that it contains. We can't just reuse the first v-model * because that would mean mutating a prop. Instead, we need a separate computed * property that manually handles setting the value and emitting an event. * * See the Radio component for sample usage. * * @param modelValueRef A reactive reference of the modelValue prop provided by * the parent component via v-model. * @param emit Vue's $emit function * @return The computed property */ export default function useModelWrapper(modelValueRef: Ref<ModelValue>, emit: (event: string, ...args: any[]) => void): WritableComputedRef<ModelValue>; export declare const modelValueProp: { type: (StringConstructor | BooleanConstructor | NumberConstructor | ArrayConstructor)[]; default: boolean; };