完善文档
Former-commit-id: 038ce2bc3c9c34e849e4b12b98b4429ab59df3e2 [formerly 038ce2bc3c9c34e849e4b12b98b4429ab59df3e2 [formerly 038ce2bc3c9c34e849e4b12b98b4429ab59df3e2 [formerly 038ce2bc3c9c34e849e4b12b98b4429ab59df3e2 [formerly d2aba79993f8cf607e0b17d1a5e03a1b44dcba4a [formerly 215dd15e9a6bd24df50bb42b309aa142eb984037]]]]] Former-commit-id: b39a2149ed889e79182ed0276917b0cdb2bcd4e8 Former-commit-id: e78c6c416b345be5d87dbfefa2b3ebc60682e405 Former-commit-id: aa2fcdd5de7e0e23bc4b65d676a65dbaefc98539 [formerly 0dc3ddb6a02f54cf1611b8e52f78fdc107fe56fd] Former-commit-id: 535b581fe45ccb3423c6fc524f4abc6d9a789b31 Former-commit-id: fae09c10ae80de05332332ce1a56aec0cdadb4f2 Former-commit-id: bd9a846c70aec65cb3e934380594fd488df5492d Former-commit-id: aee16b0242f46a4e9f426433ec0d2994f4b80529 Former-commit-id: e49ef6b10a02ab64855ffb6ce1d0a7ec93bd757d
This commit is contained in:
@@ -17,35 +17,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BScroll from 'better-scroll'
|
||||
import bs from './mixins/bs'
|
||||
export default {
|
||||
name: 'd2-container-card-bs',
|
||||
data () {
|
||||
return {
|
||||
BS: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.scrollInit()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.scrollDestroy()
|
||||
},
|
||||
methods: {
|
||||
scrollInit () {
|
||||
this.BS = new BScroll(this.$refs.wrapper, {
|
||||
mouseWheel: true,
|
||||
scrollbar: {
|
||||
fade: true,
|
||||
interactive: false
|
||||
}
|
||||
})
|
||||
},
|
||||
scrollDestroy () {
|
||||
if (this.BS) {
|
||||
this.BS.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
mixins: [
|
||||
bs
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -15,35 +15,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BScroll from 'better-scroll'
|
||||
import bs from './mixins/bs'
|
||||
export default {
|
||||
name: 'd2-container-full-bs',
|
||||
data () {
|
||||
return {
|
||||
BS: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.scrollInit()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.scrollDestroy()
|
||||
},
|
||||
methods: {
|
||||
scrollInit () {
|
||||
this.BS = new BScroll(this.$refs.wrapper, {
|
||||
mouseWheel: true,
|
||||
scrollbar: {
|
||||
fade: true,
|
||||
interactive: false
|
||||
}
|
||||
})
|
||||
},
|
||||
scrollDestroy () {
|
||||
if (this.BS) {
|
||||
this.BS.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'd2-container-card-bs',
|
||||
mixins: [
|
||||
bs
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -13,35 +13,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BScroll from 'better-scroll'
|
||||
import bs from './mixins/bs'
|
||||
export default {
|
||||
name: 'd2-container-ghost-bs',
|
||||
data () {
|
||||
return {
|
||||
BS: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.scrollInit()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.scrollDestroy()
|
||||
},
|
||||
methods: {
|
||||
scrollInit () {
|
||||
this.BS = new BScroll(this.$refs.wrapper, {
|
||||
mouseWheel: true,
|
||||
scrollbar: {
|
||||
fade: true,
|
||||
interactive: false
|
||||
}
|
||||
})
|
||||
},
|
||||
scrollDestroy () {
|
||||
if (this.BS) {
|
||||
this.BS.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'd2-container-card-bs',
|
||||
mixins: [
|
||||
bs
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
37
src/components/core/d2-container/components/mixins/bs.js
Normal file
37
src/components/core/d2-container/components/mixins/bs.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import BScroll from 'better-scroll'
|
||||
export default {
|
||||
props: {
|
||||
scrollOptions: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
BS: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.scrollInit()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.scrollDestroy()
|
||||
},
|
||||
methods: {
|
||||
scrollInit () {
|
||||
this.BS = new BScroll(this.$refs.wrapper, Object.assign({
|
||||
mouseWheel: true,
|
||||
scrollbar: {
|
||||
fade: true,
|
||||
interactive: false
|
||||
}
|
||||
}, this.scrollOptions))
|
||||
},
|
||||
scrollDestroy () {
|
||||
if (this.BS) {
|
||||
this.BS.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
</d2-container-card>
|
||||
<!-- [card] 卡片容器 滚动优化 -->
|
||||
<d2-container-card-bs v-if="type === 'card' && scroll">
|
||||
<d2-container-card-bs v-bind="$attrs" v-if="type === 'card' && scroll">
|
||||
<slot v-if="$slots.header" name="header" slot="header"/>
|
||||
<slot/>
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
@@ -19,7 +19,7 @@
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
</d2-container-ghost>
|
||||
<!-- [ghost] 隐形容器 滚动优化 -->
|
||||
<d2-container-ghost-bs v-if="type === 'ghost' && scroll">
|
||||
<d2-container-ghost-bs v-bind="$attrs" v-if="type === 'ghost' && scroll">
|
||||
<slot v-if="$slots.header" name="header" slot="header"/>
|
||||
<slot/>
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
@@ -31,7 +31,7 @@
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
</d2-container-full>
|
||||
<!-- [container-full-bs] 填充 滚动优化 -->
|
||||
<d2-container-full-bs v-if="type === 'full' && scroll">
|
||||
<d2-container-full-bs v-bind="$attrs" v-if="type === 'full' && scroll">
|
||||
<slot v-if="$slots.header" name="header" slot="header"/>
|
||||
<slot/>
|
||||
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
||||
|
||||
Reference in New Issue
Block a user