Field: support $attrs & $listeners

This commit is contained in:
陈嘉涵
2017-09-22 14:54:05 +08:00
parent 910739905c
commit 72b013a440
8 changed files with 121 additions and 274 deletions

View File

@@ -1,93 +1,9 @@
<template>
<div class="examples-container" ref="container">
<div class="demo-content" ref="demo">
<router-view></router-view>
</div>
<div class="footer" :class="{ 'footer-fixed': isFooterFixed }">
<img src="https://img.yzcdn.cn/upload_files/2017/04/18/FjupTe9o1apJhJr5qR-4ucXqPs7e.png" alt="logo" class="zanui-logo">
</div>
</div>
<router-view></router-view>
</template>
<script>
export default {
computed: {
visible() {
return ['/'].indexOf(this.$route.path) < 0;
}
},
data() {
return {
isFooterFixed: false
};
},
mounted() {
this.computeFooterFixed();
},
watch: {
'$route.path'(val) {
this.$nextTick(() => {
this.computeFooterFixed();
});
}
},
methods: {
computeFooterFixed() {
if (this.$refs.container) {
const demoSize = this.$refs.demo.getBoundingClientRect();
const containerSize = this.$refs.container.getBoundingClientRect();
if (demoSize.height < containerSize.height - 54) {
this.isFooterFixed = true;
return;
}
}
this.isFooterFixed = false;
}
}
};
</script>
<style>
body {
-webkit-font-smoothing: antialiased;
}
body, html {
height: 100%;
}
.examples-container {
height: 100%;
overflow: auto;
position: relative;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
width: 0;
}
}
.footer {
margin-top: 30px;
width: 100%;
padding: 10px 0 20px;
background: #f8f8f8;
&.footer-fixed {
position: absolute;
bottom: 0;
left: 0;
}
}
.zanui-logo {
display: block;
margin: 0 auto;
width: 150px;
height: auto;
}
</style>

View File

@@ -42,5 +42,6 @@ if (process.env.NODE_ENV !== 'production') {
new Vue({ // eslint-disable-line
render: h => h(App),
router
}).$mount('#app-container');
router,
el: '#app-container'
});

View File

@@ -41,5 +41,6 @@ if (process.env.NODE_ENV !== 'production') {
new Vue({ // eslint-disable-line
render: h => h(App),
router
}).$mount('#app-container');
router,
el: '#app-container'
});