element-ui上传文件带token

template>
    <el-upload action="test" :headers="myHeaders"></el-upload>
</template>

<script>
var token =  localStorage.getItem('token') // 要保证取到

export default {
    data () {
        return {
            myHeaders: {Authorization: token}
        }
    }
}
</script>

 

posted @ 2018-08-14 10:27  安筱雨  阅读(8711)  评论(0编辑  收藏  举报