forked from alexjoverm/v-runtime-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.plugin.js
40 lines (36 loc) · 945 Bytes
/
test.plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//https://vuejs.org/v2/guide/plugins.html
//https://dev.to/nkoik/writing-a-very-simple-plugin-in-vuejs---example-8g8
// This exports the plugin object.
import Test from "./Test.vue"
export default {
// The install method will be called with the Vue constructor as
// the first argument, along with possible options
install(Vue) {
Vue.mixin({
components:{Test},
props: {
testingProp: {
default: "mixinTest: testingProp"
}
},
data() {
return {
testingData: "mixinTest: testingData"
};
},
computed: {
testingComputed() {
return "mixinTest: testingComputed";
}
},
methods: {
testingMethod() {
return "mixinTest: testingMethod";
}
}
}); //end mixin
Vue.prototype.$testProto = function (str) {
return "mixinTest: testingProto=" + str;
}; //end $testProto
}
};