123456789101112131415161718192021222324252627282930313233 |
- <template>
- <div id="app">
- <router-view />
- </div>
- </template>
- <script>
- export default {
- data() {
- return {};
- },
- mounted() {
- window.onresize = () => {
- return (() => {
- // 为了对应不同的应用场景,添加了两种触发方式(全局变量缓存、全局事件总线)
- this.$store.commit("changeWindowsSize", document.body.clientWidth, document.body.clientHeight);
- this.$bus.$emit("windowOnresize", {
- windowsWidth: document.body.clientWidth,
- widthsHeight: document.body.clientHeight
- });
- })();
- };
- }
- };
- </script>
- <style scoped>
- #app {
- border: 0px;
- margin: 0px;
- width: 100%;
- height: 100%;
- }
- </style>
|