添加到三种类型的组件上

Former-commit-id: d4b6d9fe642f5e299251b0edc1715a94334aeac7 [formerly d4b6d9fe642f5e299251b0edc1715a94334aeac7 [formerly d4b6d9fe642f5e299251b0edc1715a94334aeac7 [formerly d4b6d9fe642f5e299251b0edc1715a94334aeac7 [formerly a9078cd702fc26aea4790714afe151ec37012a56 [formerly ef67c393100d7c969ae2b5724b1320df73b87d3a]]]]]
Former-commit-id: e198314fdd7311aca3be5ad7fbaf76e238e1cba0
Former-commit-id: f7cbb90136f1f26a8a63f09289cc690fa6f3b542
Former-commit-id: 7826bd1a8e815d8ae77e5bdf6b35b2d5ea6de4ba [formerly 5f6c26021ffd1a0491b7b1f656ef6c7d67547eaa]
Former-commit-id: 80dd044d5dbef9d01816b97485276e7ca58fbba8
Former-commit-id: c0ee83666c68615ed4f5803a9f2d46c26c9105a6
Former-commit-id: bb0e8c35b2095ce60d82127fa44ed9a2035b4d12
Former-commit-id: cf982060447f3887ac2a63b29925364c3139d213
Former-commit-id: ef4a29d1348fc52ef062a80fb640ddfe86c481bc
This commit is contained in:
liyang
2018-11-16 10:52:53 +08:00
parent 93b718bd12
commit b6c2ed77a4
4 changed files with 21 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
<slot name="header"/>
</div>
<div class="d2-container-card__body">
<div class="d2-container-card__body-card">
<div class="d2-container-card__body-card" ref="body">
<slot/>
</div>
</div>
@@ -15,7 +15,11 @@
</template>
<script>
import scroll from './mixins/normal'
export default {
name: 'd2-container-card'
name: 'd2-container-card',
mixins: [
scroll
]
}
</script>

View File

@@ -13,7 +13,7 @@
</template>
<script>
import scroll from './mixins/scroll.normal'
import scroll from './mixins/normal'
export default {
name: 'd2-container-full',
mixins: [

View File

@@ -3,7 +3,7 @@
<div v-if="$slots.header" class="d2-container-ghost__header" ref="header">
<slot name="header"/>
</div>
<div class="d2-container-ghost__body">
<div class="d2-container-ghost__body" ref="body">
<slot/>
</div>
<div v-if="$slots.footer" class="d2-container-ghost__footer" ref="footer">
@@ -11,3 +11,13 @@
</div>
</div>
</template>
<script>
import scroll from './mixins/normal'
export default {
name: 'd2-container-ghost',
mixins: [
scroll
]
}
</script>

View File

@@ -49,10 +49,11 @@ export default {
// 外部调用的方法 返回顶部
scrollToTop () {
const smoothscroll = () => {
var currentScroll = this.$refs.body.scrollTop
const body = this.$refs.body
const currentScroll = body.scrollTop
if (currentScroll > 0) {
window.requestAnimationFrame(smoothscroll)
this.$refs.body.scrollTo(0, currentScroll - (currentScroll / 5))
body.scrollTo(0, currentScroll - (currentScroll / 5))
}
}
smoothscroll()