A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

3.2.3 子组件(我的媒资查询)
1、定义ischoose变量,接收父组件传入的ischoose
[AppleScript] 纯文本查看 复制代码
export default{
   props: ['ischoose'],   data(){

2、父组件传的ischoose变量为 true时表示当前是选择媒资文件业务,需要控制页面元素是否显示
1)ischoose=true,选择按钮显示

[AppleScript] 纯文本查看 复制代码
<el‐table‐column label="选择" width="80" v‐if="ischoose == true">   
 <template slot‐scope="scope">   
 <el‐button     
 size="small" type="primary" plain @click="choose(scope.row)">选择</el‐button>  
  </template>  </el‐table‐column>

2)ischoose=false,视频处理按钮显示

[AppleScript] 纯文本查看 复制代码
<el‐table‐column label="开始处理" width="100" v‐if="ischoose != true">  
  <template slot‐scope="scope">    
  <el‐button    
    size="small" type="primary" plain @click="process(scope.row.fileId)">开始处理   
   </el‐button>  
  </template>  </el‐table‐column> 

3、选择媒资文件方法
用户点击“选择”按钮将向父组件传递媒资文件信息

[AppleScript] 纯文本查看 复制代码
choose(mediaFile){    
  if(mediaFile.processStatus !='303002' && mediaFile.processStatus !='303004'){   
     this.$message.error('该文件未处理,不允许选择');    
    return ;   
   }   
if(!mediaFile.fileUrl){   
   this.$message.error('该文件的访问url为空,不允许选择');   
   return ;  
  }   
 //调用父组件的choosemedia方法    this.$emit('choosemedia',mediaFile.fileId,mediaFile.fileOriginalName);  }


0 个回复

您需要登录后才可以回帖 登录 | 加入黑马