1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| <template>
| <div>
| <pre v-html="content"></pre>
| </div>
| </template>
|
| <script setup>
| import { ref, watch } from "vue";
|
| let content = ref("");
| // 获取父组件传递的资源url
| const props = defineProps({
| previewSrc: {
| type: String,
| required: false,
| default: () => ""
| }
| });
|
| const getContent = (url) => {
| fetch(url)
| .then((res) => res.text())
| .then((data) => {
| content.value = data;
| });
| };
| getContent(props.previewSrc);
|
|
| const comStyle = {
| width: "100%",
| height: "100%"
| };
|
| const renderedHandler = () => {
| console.log("rendered");
| };
| const errorHandler = (err) => {
| console.log("error", err);
| };
| </script>
|
| <style scoped lang="less">
| .aUpload {
| position: absolute;
| top: 0;
| left: 0;
| }
| </style>
|
|