html:
复制代码
1
2
3
4
5
6
7
8<template> <div> <Modal v-model="classStatus" width="900" title="详情:" :styles="{top: '80px'}"> <Table stripe class="task-table" :columns="columnsName4" :data="taskDetailList"></Table> </Modal> <div @click="showtaskDetail()">点击弹窗按钮</div> </div> </template>
js:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29<script> import http from '@/assets/http.js' export default { name: 'xx', data () { return { columnsName4: [ { title: '序号', key: 'id', align: 'center', width: 70 }, { title: '姓名', key: 'name', align: 'center', width: 80 } ], taskDetailList: [], classStatus: false } }, methods: { showtaskDetail () { this.classStatus = true }, }
css:
复制代码
1
2
3
4.task-table { margin-top: 10px; margin-bottom: 50px; }
补充知识:vue通过this.$refs引用子组件出现undefined或者is not a function的错误
1.出现undefined错误
包含子组件的标签需要放在<template></template>中第一个子标签的子标签中,而且需要设置ref属性,通过该属性调用子组件的方法或者属性,例如
复制代码
1
2
3
4
5
6
7
8<template> <a-card :bordered="false"> <s-table> ... </s-table> <order-edit ref="modal" @ok="handleOk" /> <!-使用子组件--> </a-card> </template>
this.$refs.modal.show() //子组件有show方法,调用方式`.方法名()`
2.出现is not a function的错误
2.1.子组件需要import,import是请确保路径正确
2.2.import之后还需要在父组件的component中进行注册
复制代码
1
2
3
4
5
6
7
8
9
10
11
12<script> import OrderEdit from './form/OrderEdit' //1.导入编辑表单子组件组件 export default { name: 'OrderList', //2注册子组件OrderEdit components:{ OrderEdit } //..... } </script>
以上这篇vue实现点击按钮“查看详情”弹窗展示详情列表操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持靠谱客。
最后
以上就是可爱黄豆最近收集整理的关于vue实现点击按钮“查看详情”弹窗展示详情列表操作的全部内容,更多相关vue实现点击按钮“查看详情”弹窗展示详情列表操作内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复