vue實(shí)現(xiàn)點(diǎn)擊按鈕“查看詳情”彈窗展示詳情列表操作
html:
<template> <div> <Modal v-model='classStatus' :styles='{top: ’80px’}'> <Table stripe :columns='columnsName4' :data='taskDetailList'></Table> </Modal> <div @click='showtaskDetail()'>點(diǎn)擊彈窗按鈕</div> </div></template>
js:
<script>import http from ’@/assets/http.js’export default { name: ’xx’, data () { return { columnsName4: [ { title: ’序號(hào)’, key: ’id’, align: ’center’, width: 70 }, { title: ’姓名’, key: ’name’, align: ’center’, width: 80 } ], taskDetailList: [], classStatus: false }},methods: { showtaskDetail () { this.classStatus = true }, }
css:
.task-table { margin-top: 10px; margin-bottom: 50px;}
補(bǔ)充知識(shí):vue通過(guò)this.$refs引用子組件出現(xiàn)undefined或者is not a function的錯(cuò)誤
1.出現(xiàn)undefined錯(cuò)誤
包含子組件的標(biāo)簽需要放在<template></template>中第一個(gè)子標(biāo)簽的子標(biāo)簽中,而且需要設(shè)置ref屬性,通過(guò)該屬性調(diào)用子組件的方法或者屬性,例如
<template> <a-card :bordered='false'> <s-table> ... </s-table> <order-edit ref='modal' @ok='handleOk' /> <!-使用子組件--> </a-card></template>
this.$refs.modal.show() //子組件有show方法,調(diào)用方式`.方法名()`
2.出現(xiàn)is not a function的錯(cuò)誤
2.1.子組件需要import,import是請(qǐng)確保路徑正確
2.2.import之后還需要在父組件的component中進(jìn)行注冊(cè)
<script>import OrderEdit from ’./form/OrderEdit’ //1.導(dǎo)入編輯表單子組件組件export default { name: ’OrderList’, //2注冊(cè)子組件OrderEdit components:{ OrderEdit } //..... }</script>
以上這篇vue實(shí)現(xiàn)點(diǎn)擊按鈕“查看詳情”彈窗展示詳情列表操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 在Android中使用WebSocket實(shí)現(xiàn)消息通信的方法詳解2. python matplotlib:plt.scatter() 大小和顏色參數(shù)詳解3. Yii2.0引入CSS,JS文件方法4. JSP數(shù)據(jù)交互實(shí)現(xiàn)過(guò)程解析5. Python importlib動(dòng)態(tài)導(dǎo)入模塊實(shí)現(xiàn)代碼6. vue使用webSocket更新實(shí)時(shí)天氣的方法7. 淺談python出錯(cuò)時(shí)traceback的解讀8. android studio 打包自動(dòng)生成版本號(hào)與日期,apk輸入路徑詳解9. Nginx+php配置文件及原理解析10. JavaMail 1.4 發(fā)布
