<template>
<div >
<Row>
<i-col span="14">
<span>上传文件:</span>
<a href="javascript:;" class="a-upload">
<input type="file" @change="tirggerFile($event)">点击这里上传文件
</a>
</div>
</template>
<script>
export default {
methods:{
tirggerFile(event) {
//此处校验文件后缀
var file = event.target.files[0].name; // (利用console.log输出看file文件对象)json
var num = file.split('.');
var mun = num[num.length - 1];
if ( mun == 'json') {
this.readFile();
} else {
this.$Notice.error({
title: '请重新点击选择文件传入符合标准的文件',
duration: 2
});