Update $refs type declaration (#3765)

* `$refs` is a dictionary of Vue instance or Element

* update $refs for array usage
This commit is contained in:
(´・ω・`) 2016-09-28 14:04:08 -05:00 committed by Evan You
parent 1d3811af78
commit aefb34812e
2 changed files with 15 additions and 1 deletions

View File

@ -13,6 +13,20 @@ class Test extends Vue {
this.$isServer;
}
// test property reification
$refs: {
vue: Vue,
element: HTMLInputElement,
vues: Vue[],
elements: HTMLInputElement[]
}
testReification() {
this.$refs.vue.$data;
this.$refs.element.value;
this.$refs.vues[0].$data;
this.$refs.elements[0].value;
}
testMethods() {
this.$mount("#app", false);
this.$forceUpdate();

2
types/vue.d.ts vendored
View File

@ -19,7 +19,7 @@ export declare class Vue {
readonly $parent: Vue;
readonly $root: Vue;
readonly $children: Vue[];
readonly $refs: { [key: string]: Vue };
readonly $refs: { [key: string]: Vue | Element | Vue[] | Element[]};
readonly $slots: { [key: string]: VNode[] };
readonly $isServer: boolean;