当前位置: 移动技术网 > IT编程>脚本编程>vue.js > vue实现点击按钮“查看详情”弹窗展示详情列表操作

vue实现点击按钮“查看详情”弹窗展示详情列表操作

2020年09月10日  | 移动技术网IT编程  | 我要评论
html:<template> <div> <modal v-model="classstatus" width="900" title="详情:" :styles="{

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()">点击弹窗按钮</div>
 </div>
</template>

js:

<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:

.task-table {
 margin-top: 10px;
 margin-bottom: 50px;
}

补充知识:vue通过this.$refs引用子组件出现undefined或者is not a function的错误

1.出现undefined错误

包含子组件的标签需要放在<template></template>中第一个子标签的子标签中,而且需要设置ref属性,通过该属性调用子组件的方法或者属性,例如

<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中进行注册

<script>
import orderedit from './form/orderedit' //1.导入编辑表单子组件组件
export default {
 name: 'orderlist',
 //2注册子组件orderedit
 components:{
 orderedit
 }
 //..... 

}
</script>

以上这篇vue实现点击按钮“查看详情”弹窗展示详情列表操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网