44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
<template>
|
|
<iframe id="iframe" frameborder="0"></iframe>
|
|
</template>
|
|
|
|
<script>
|
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
|
import Vue from 'vue'
|
|
export default {
|
|
name: 'ocrSplit',
|
|
data(){
|
|
return{
|
|
token:Vue.ls.get(ACCESS_TOKEN),
|
|
}
|
|
},
|
|
mounted() {
|
|
setTimeout(() => {
|
|
var iframe = document.querySelector("#iframe");
|
|
this.populateIframe(iframe, [["X-Access-Token", this.token]]);
|
|
}, 0);
|
|
},
|
|
methods:{
|
|
populateIframe(iframe, headers) {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("GET", 'http://10.0.1.31:8080/jero-boot/ocr/pageOffice/word');
|
|
xhr.responseType = "blob";
|
|
headers.forEach((header) => {
|
|
xhr.setRequestHeader(header[0], header[1]);
|
|
});
|
|
xhr.onreadystatechange = () => {
|
|
if (xhr.readyState === xhr.DONE) {
|
|
if (xhr.status === 200) {
|
|
iframe.src = URL.createObjectURL(xhr.response);
|
|
}
|
|
}
|
|
};
|
|
xhr.send();
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |