Parámetros de enrutamiento de vue front-end



1. Utilice el enrutamiento para pasar parámetros y abrir en una nueva interfaz (modo de función)

Haga clic en el botón para abrir la ruta en la nueva interfaz y transferir parámetros

Paso:

AddBatch(monthid, partname) {
    
    
        console.log(monthid);
        console.log(partname);
        const {
    
    
          href
        } = this.$router.resolve({
    
    
          name: 'addbatch',
          query: {
    
    
            productname: this.productname, // 传过去产品Id
            partname: partname, // 传过去产品的名字
            month: this.month, // 把年份传过去
            monhtid: monthid, // 把月份 id 传过去
          }
        })
        window.open(href, '_blank')
      },

Aceptar parámetros:

          this.PageInti.productname = this.$route.query.productname,
          this.PageInti.partname = this.$route.query.partname,
          this.PageInti.monthname = this.$route.query.month,
          this.PageInti.monthid = this.$route.query.monthid



2. Utilice etiquetas de enlace de enrutador

Simplemente agregue el atributo target = '_ blank' directamente, de todos modos, eventualmente se interpretará como una etiqueta

<router-link :to="{path: '/footer'}"  target="_blank"  tag="a">
footer
</router-link>

Supongo que te gusta

Origin blog.csdn.net/zhaozhao236/article/details/112668300
Recomendado
Clasificación