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