@@ -83,6 +83,7 @@ export default {
*/
this.$refs.getMain.$on("ab", this.aa);
console.log(this.$refs.getMain.$on("ab", this.aa));
+ // this.showMains();
},
};
</script>
@@ -4,10 +4,12 @@
<h1>作用域插槽</h1>
<slot :obj1="obj" name="x">{{ obj.age }}</slot>
<h1>2222222</h1>
+ <button @click="Send">执行</button>
</div>
</template>
<script>
+import { mixin } from '../utils/mixin';
export default {
data() {
return {
@@ -17,6 +19,13 @@ export default {
+ mixins:[mixin],
+ methods:{
+ Send() {
+ this.showThing();
+ // this.showMains()
+ }
@@ -1,9 +1,10 @@
import Vue from 'vue'
import App from './App.vue'
-
+// import { mixin } from './utils/mixin.js'
Vue.config.productionTip = false
// 全局挂载事件总线
Vue.prototype.$bus = new Vue()
+// Vue.mixin(mixin);
new Vue({
render: h => h(App),
}).$mount('#app')
@@ -0,0 +1,13 @@
+export const mixin = {
+ created() {
+ console.log("展示");
+ },
+ showMains() {
+ console.log("你好");
+ showThing() {
+ console.log("大家好");
+}