| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <template>
- <div v-html="content"></div>
- </template>
- <script>
- import axios from "axios";
- export default {
- data() {
- return {
- content: '',
- }
- },
- // async asyncData() {
- // const { data } = await axios(`http://192.168.1.81:8101/parent/parentClub/activityGameHtml/?id=1`); // 测试html
- // console.log(data);
- // const content = data.data;
- // return {
- // content
- // }
- // }
- created() {
- this.loadHtml();
- },
- methods: {
- async loadHtml() {
- const { data } = await axios(`http://192.168.1.81:8101/parent/parentClub/activityGameHtml/?id=1`); // 测试html
- const content = this.decodeUnicode(data.data);
- document.write(content);
- // this.content = content;
- },
- decodeUnicode(str) {
- str = str.replace(/\\/g, "%");
- //转换中文
- str = unescape(str);
- //将其他受影响的转换回原来
- str = str.replace(/%/g, "\\");
- //对网址的链接进行处理
- str = str.replace(/\\n/g, "");
- str = str.replace(/\\t/g, "");
- str = str.replace(/\\/g, "");
- return str;
- }
- }
- }
- </script>
|