vue實(shí)現(xiàn)點(diǎn)擊按鈕“查看詳情”彈窗展示詳情列表操作
html:
<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()">點(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通過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屬性,通過該屬性調(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)擊按鈕“查看詳情”彈窗展示詳情列表操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
vue.js 實(shí)現(xiàn)點(diǎn)擊按鈕動(dòng)態(tài)添加li的方法
今天小編就為大家分享一篇vue.js 實(shí)現(xiàn)點(diǎn)擊按鈕動(dòng)態(tài)添加li的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-09-09Vue如何實(shí)現(xiàn)分批加載數(shù)據(jù)
這篇文章主要介紹了Vue如何實(shí)現(xiàn)分批加載數(shù)據(jù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-04-04去除Element-Plus下拉菜單邊框的實(shí)現(xiàn)步驟
Element-Plus 是 Element UI 的 Vue 3 版本,它提供了一套完整的組件庫,在使用 Element-Plus 進(jìn)行開發(fā)時(shí),我們可能會(huì)遇到需要自定義組件樣式的情況,本文將介紹如何使用 CSS 來去除 Element-Plus 下拉框的邊框,需要的朋友可以參考下2024-03-03vue3中el-table實(shí)現(xiàn)多表頭并表格合并行或列代碼示例
這篇文章主要給大家介紹了關(guān)于vue3中el-table實(shí)現(xiàn)多表頭并表格合并行或列的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用vue具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2024-02-02