diff --git a/docs/zh/components/container.md b/docs/zh/components/container.md index e5dabe9a..953acd30 100644 --- a/docs/zh/components/container.md +++ b/docs/zh/components/container.md @@ -9,6 +9,12 @@ | type | 容器类型 | 非 | String | card ghost full | card | | responsive | 响应式宽度 | 非 | Boolean | | false | +## 事件 + +| 事件名 | 介绍 | 回调参数 | +| --- | --- | --- | +| resized | type 为 full 时页面完成尺寸计算会触发此事件 | | + ::: tip `responsive` 参数设置只在 `type` 等于 `card` 或 `ghost` 时生效 ::: diff --git a/src/components/core/d2-container/components/d2-container-full.vue b/src/components/core/d2-container/components/d2-container-full.vue index 7432efcc..7cb9cc16 100644 --- a/src/components/core/d2-container/components/d2-container-full.vue +++ b/src/components/core/d2-container/components/d2-container-full.vue @@ -47,6 +47,9 @@ export default { mounted () { this.headerHeight = this.$slots.header ? this.$refs.header.offsetHeight : 0 this.footerHeight = this.$slots.footer ? this.$refs.footer.offsetHeight : 0 + this.$nextTick(() => { + this.$emit('resized') + }) }, computed: { cardStyle () { diff --git a/src/components/core/d2-container/index.vue b/src/components/core/d2-container/index.vue index e521387a..5119d139 100644 --- a/src/components/core/d2-container/index.vue +++ b/src/components/core/d2-container/index.vue @@ -11,7 +11,7 @@ - + diff --git a/src/pages/demo/plugins/better-scroll/to.vue b/src/pages/demo/plugins/better-scroll/to.vue index de8eb9cf..1e2db7ca 100644 --- a/src/pages/demo/plugins/better-scroll/to.vue +++ b/src/pages/demo/plugins/better-scroll/to.vue @@ -1,9 +1,9 @@ @@ -54,8 +57,15 @@ export default { fade: true } }) + const a = 'abc' + const b = 'abc' + console.log(a == b) + console.log(a === b) }, methods: { + handleResize () { + this.BS.refresh() + }, handleScrollTo (y) { this.BS.scrollTo(0, -y, this.time) },