<el-table-column label="电表编码" align="center" width="120" prop="electricalNum" ><template slot-scope="scope"><div style="text-align: left"><router-link :to="'/equipment/electrical-data/index/' + scope.row.electricalId" class="link-type"><span>{{ scope.row.electricalNum }}</span></router-link><div style="white-space:nowrap">初始表码: <span style="color: #1348ce;">{{ scope.row.electricalInitNum}}</span> </div><div style="white-space:nowrap">结算表码: <span style="color: #1348ce;">{{ scope.row.electricalEndNum}}</span> </div></div></template></el-table-column>
router-link 这里需要去/src/router/index.js里面配置
{path: '/equipment/electrical-data',component: Layout,hidden: true,permissions: ['equipment:electrical:list'],children: [{path: 'index/:electricalId(\\d+)',component: () => import('@/views/equipment/electrical/electri'),name: 'Data',meta: { title: '电表详情', activeMenu: '/equipment/electrical' }}]},
跳转过来是这样的查看页面 :column 是对应的几列展示
<el-descriptions class="margin-top" title="电表详情" :column="3" :size="'mini'" border><el-descriptions-item><template slot="label">电表名称</template>{{form.electricalName}}</el-descriptions-item><el-descriptions-item><template slot="label">电表品牌</template><dict-tag :options="dict.type.sys_meter_brand" :value="form.electricalBrand"/></el-descriptions-item></el-descriptions>
这里是获取$route路由传过来的值
created() {const electricalId = this.$route.params && this.$route.params.electricalId;},
##父子传值
父:方法绑定按钮 传入队友的值 直接就携带值跳转到对应路由
getBillInfo(row,type){const electricalId = row.electricalId || this.idsthis.$router.push({ path: '/finance/bill', query: { electricalId: electricalId,proprietorPayType:type } }) // 跳转到B},
子:直接路由.query属性就能获取
created() {console.log(this.$route.query);this.queryParams.proprietorPayType=this.$route.query.proprietorPayType;this.queryParams.electricalId=this.$route.query.electricalId;this.getList();},