Vue implements cross-page calling methods and nested pages

1. If you want to implement the method of calling another page from the current page, you first need to encapsulate a page into a template, the path is the path of the page of the called method, in <script> </ script>

import varsetting from "@/components/test/varsetting";

  export default {
      components: {varsetting}
  }

2. In <template> </ template>, use the defined varsetting

<varsetting :varDefineList="varDefineList" ref="setting"></varsetting>

3. Use $ refs to call the method of the page, provided that there is an init () method in the varsetting page

this.$refs.setting.init();

  

Guess you like

Origin www.cnblogs.com/HKSam/p/12746269.html