Vue实现详细界面里面有一个列表

目录

Vue实现详细界面里面有一个列表

理一下思路:

效果如下:

[1、 主页面正常写](#1、 主页面正常写)

2、详细界面(重点)

3、详细界面里面的列表(重点)

要点:


Vue实现详细界面里面有一个列表

理一下思路:

1、首先需要这条数据的主键id,用它来获得详细界面所需的值,

2、在详细界面中通过父子组件的关系传递这个id,使得自己写的列表组件可以获得这个id值去查数据。

效果如下:

1、 主页面正常写

css 复制代码
<span @click="addOrUpdateHandle(scope.row.id,true)">详情</span>

addOrUpdateHandle(id, isDetail) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.xxxxx.init(id, isDetail)
})

},

2、详细界面(重点)

:pid="dataForm.id"

css 复制代码
  <el-col :span="24"">
              <template>
                <el-tabs >
                  <div class="">信息</div>
                  <recordForm :pid="dataForm.id" :cylx="0" :isCheck="!!isDetail" style="height: 500px"></recordForm>
                </el-tabs>
              </template>
            </el-col>

PS:记得导入你自己写的组件

3、详细界面里面的列表(重点)

注意关注 pid

css 复制代码
created() {
    if (!(this.pid == '' || this.pid == undefined)) {
      this.finitData(this.pid)
    }

  },
css 复制代码
 methods: {
    finitData(v_id, flag) {
      this.query.xxxId = v_id
      this.listLoading = true
      let query = {
        ...this.listQuery,
        ...this.query
      }
      request({
        url: ``, 
        method: 'get',
        data: query
      }).then(res => {
        this.list = res.data.list
        this.total = res.data.pagination.total
        this.listLoading = false
        this.$nextTick(() => {
          this.tableHeight = '100%'
        })
      })
    },
}

要点:

就是 父子传id,这里面个人感觉像是 爷传父、父传子

相关推荐
星栈7 分钟前
Dioxus 多页面怎么做:`dioxus-router`、嵌套路由、`Outlet` 和页面组织,一篇给你讲顺
前端·rust·前端框架
用户9874092388711 分钟前
用 Remotion + edge-tts 打造中文教学视频全自动流水线
前端
风骏时光牛马12 分钟前
Less前端工程化实战:变量混合器与项目样式分层落地
前端
假如让我当三天老蒯15 分钟前
Options API(选项式 API) 和 Composition API(组合式 API)
前端·vue.js·面试
SameX17 分钟前
iOS 独立开发实践:用 MapKit + 像素渲染实现 Citywalk 轨迹地图 App「雁过留痕」
前端
_柳青杨17 分钟前
一文吃透 Node.js 事件循环:从原理到 Node 20+ 重大变更
javascript·后端
skyey33 分钟前
页面加载时,深色模式闪白的问题解决
前端
IT_陈寒44 分钟前
Java 并行流把我坑惨了,这6小时加班值了
前端·人工智能·后端
anOnion10 小时前
构建无障碍组件之Menu Button pattern
前端·html·交互设计
用户479492835691511 小时前
claude Fable用不了?把Gpt 5.5pro接到你的claude code里
前端·后端