|
@@ -68,12 +68,14 @@ interface ICat {
|
|
|
foo: any,
|
|
foo: any,
|
|
|
bar: object
|
|
bar: object
|
|
|
}
|
|
}
|
|
|
|
|
+type ConfirmCallback = (confirm: boolean) => void;
|
|
|
|
|
|
|
|
Vue.component('union-prop', {
|
|
Vue.component('union-prop', {
|
|
|
props: {
|
|
props: {
|
|
|
cat: Object as PropType<ICat>,
|
|
cat: Object as PropType<ICat>,
|
|
|
complexUnion: { type: [User, Number] as PropType<User | number> },
|
|
complexUnion: { type: [User, Number] as PropType<User | number> },
|
|
|
kittyUser: Object as PropType<ICat & IUser>,
|
|
kittyUser: Object as PropType<ICat & IUser>,
|
|
|
|
|
+ callback: Function as PropType<ConfirmCallback>,
|
|
|
mixed: [RegExp, Array],
|
|
mixed: [RegExp, Array],
|
|
|
object: [Cat, User],
|
|
object: [Cat, User],
|
|
|
primitive: [String, Number],
|
|
primitive: [String, Number],
|
|
@@ -84,6 +86,7 @@ Vue.component('union-prop', {
|
|
|
this.cat;
|
|
this.cat;
|
|
|
this.complexUnion;
|
|
this.complexUnion;
|
|
|
this.kittyUser;
|
|
this.kittyUser;
|
|
|
|
|
+ this.callback(true);
|
|
|
this.mixed;
|
|
this.mixed;
|
|
|
this.object;
|
|
this.object;
|
|
|
this.primitive;
|
|
this.primitive;
|
|
@@ -281,6 +284,18 @@ Vue.component('component', {
|
|
|
delimiters: ["${", "}"]
|
|
delimiters: ["${", "}"]
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+Vue.component('custom-prop-type-function', {
|
|
|
|
|
+ props: {
|
|
|
|
|
+ callback: Function as PropType<(confirm: boolean) => void>,
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ confirm(){
|
|
|
|
|
+ this.callback(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
Vue.component('provide-inject', {
|
|
Vue.component('provide-inject', {
|
|
|
provide: {
|
|
provide: {
|
|
|
foo: 1
|
|
foo: 1
|