The vue jump page carries parameters and executes the method immediately

1. First define the jump function

This is a link jump

<a href="javascript:void(0)" onclick="openPage()">位移变化趋势图</a></td></tr>
			</table>
 methods: {
    openPage(){
              // this.$router.push('/dis/show');
        this.$router.push({path: '/dis/show',
        query: {
          searchObj: { type:"monitoring1" ,data:"data_real",begin:"2018-12-20",end:"2018-12-29"}
                 }              
               });

2. Jump to the page to receive parameters

 data() {
        return {
          searchObj:{},
          btnDisabled:false
        }
    },
    created(){
   this.getParams(),
    this.showChart() 
  },
    methods:{
      getParams(){
    // 取到路由带过来的参数赋值给searchObj
    this.searchObj = this.$route.query.searchObj
   },

3. Execute the method directly after the jump

Insert picture description here
It is executed directly on the jump page

Guess you like

Origin blog.csdn.net/he1234555/article/details/115323866