refactor: 使用setup重构 src/

components/realTimeView/index.vue
This commit is contained in:
王奥斯 2022-02-23 09:48:46 +08:00
parent 4ac8f3b0d3
commit f2d953dd96

View File

@ -16,6 +16,7 @@
</template> </template>
<script> <script>
import { ref } from 'vue';
export default { export default {
name: 'RealTimeView', name: 'RealTimeView',
props: { props: {
@ -24,17 +25,21 @@ export default {
}, },
val:Object val:Object
}, },
data() { setup(props) {
return { //
loading: true const loading = ref(true)
//
const load = () => {
loading.value = false
document.querySelector('iframe').contentWindow.postMessage(props.val, "http://was666.gitee.io");
} }
},
methods: { return{
load() { loading,
this.loading = false load
this.$refs["iframe"].contentWindow.postMessage(this.val, "http://was666.gitee.io"); }
}, }
},
} }
</script> </script>