亲测可用,若有疑问请私信
展示效果
代码
<template>
<div class="about">
<my-component></my-component>
<h3>展示Excel文件</h3>
<iframe frameborder="0"
:src="'https://view.officeapps.live.com/op/view.aspx?src=' + this.url"
width='100%' height="500px">
</iframe>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
data() {
return {
rawHtml: '<span style="color: red">This should be red.</span>'
}
},
setup() {
const url = '文件地址'
return { url }
}
})
</script>
注意
文件地址必须要带域名的地址,且端口为80。