大屏切换
This commit is contained in:
41
src/pages/HomeScreen.vue
Normal file
41
src/pages/HomeScreen.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<section class="box">
|
||||
<Monitoring-Screen v-if="page === 'two'"></Monitoring-Screen>
|
||||
<Device-Screen v-if="page === 'one'"></Device-Screen>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MonitoringScreen from './MonitoringScreen.vue'
|
||||
import DeviceScreen from './DeviceScreen.vue'
|
||||
export default {
|
||||
name: 'HomeScreen',
|
||||
components: {
|
||||
MonitoringScreen,
|
||||
DeviceScreen
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
page: 'one',
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.swipePage()
|
||||
},
|
||||
methods: {
|
||||
swipePage () {
|
||||
this.timer = setInterval(() => {
|
||||
this.page = this.page === 'one' ? 'two' : 'one'
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@css/mixin'
|
||||
.box
|
||||
_wh(100%, 100%)
|
||||
overflow hidden
|
||||
</style>
|
||||
Reference in New Issue
Block a user