mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
Update $refs
type declaration (#3765)
* `$refs` is a dictionary of Vue instance or Element * update $refs for array usage
This commit is contained in:
parent
1d3811af78
commit
aefb34812e
@ -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
2
types/vue.d.ts
vendored
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user