<script>
import d2 from ‘./d2.vue‘
//导入jquery
import $ from ‘jquery‘
export default {
data () {
return {
msg: "这是一个变量",
dataList:[],
clicked:0,
upath: ‘‘,
result: ‘‘,
uping:0
}
},
components: {
‘v-header‘: d2
},
mounted:function(){
let test = $(‘#test‘).html();
console.log(test);
//绑定父类盒子
$("#my_box").on("click",".newBtn",this.my_click_two);
},
methods:{
upload: function () {
var name = this.username;
// alert(name);
//进行初始化传参 let局部变量
let param = new URLSearchParams();
//将参数传递给对象
param.append(‘name‘,name);
var zipFormData = new FormData();
zipFormData.append(‘file‘, this.upath);
//filename是键,file是值,就是要传的文件
let config = { headers: { ‘Content-Type‘: ‘multipart/form-data‘ } };
this.uping = 1;
this.$http.post(‘http://localhost:8000/bash_admin_user/uploadmp4‘, zipFormData,config).then(function (response) {
console.log(response);
console.log(response.data);
this.uping = 0;
this.result = response.data;
//绑定播放地址
this.$refs.video.src = response.data.url;
});
},
getFile: function (even) {
this.upath = event.target.files[0];
},
}
}
</script>