JavaScript/vue.js/调用其他组件的函数:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第1行: 第1行:
== 引言 ==
== 引言 ==
在被调用的方法所在的文件中,使用事件车注册事件。
在被调用的方法所在的文件中,使用事件车注册事件。
{{hc|bus.js|<syntaxhighlight lang="javascript">
/*!
* @auther kangkk
* @desc 事件车
*/
import Vue from 'vue'
export default new Vue()</syntaxhighlight>}}


{{hc|listLeft.vue|<syntaxhighlight lang="html">
{{hc|listLeft.vue|<syntaxhighlight lang="html">
<script>
<script>
import EventBus from '@@/plugins/bus.js'
mounted(){
mounted(){
   const _self = this;
   const _self = this;
第17行: 第26行:
{{hc|searchmodule.vue|<syntaxhighlight lang="html">
{{hc|searchmodule.vue|<syntaxhighlight lang="html">
<script>
<script>
import EventBus from '@@/plugins/bus.js'
inputValueChange () {
inputValueChange () {
   if(this.$route.path === '/search') {
   if(this.$route.path === '/search') {