zheng пре 1 недеља
родитељ
комит
512db33032

+ 1 - 0
vue/高阶/project1/src/App.vue

@@ -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>

+ 9 - 0
vue/高阶/project1/src/components/Demo8.vue

@@ -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()
+    }
+  }
 };
 </script>
 

+ 2 - 1
vue/高阶/project1/src/main.js

@@ -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')

+ 13 - 0
vue/高阶/project1/src/utils/mixin.js

@@ -0,0 +1,13 @@
+export const mixin = {
+    created() {
+        console.log("展示");
+    },
+    methods:{
+        showMains() {
+            console.log("你好");
+        },
+        showThing() {
+            console.log("大家好");
+        }
+    }
+}