Merge branch 'dev' into next

This commit is contained in:
chenjiahan
2020-09-10 16:44:24 +08:00
7 changed files with 51 additions and 49 deletions

View File

@@ -1,5 +1,4 @@
// Utils
import { inBrowser } from '../utils';
import { bem, createComponent } from './shared';
import { callInterceptor } from '../utils/interceptor';
@@ -79,13 +78,13 @@ export default createComponent({
data() {
return {
active: 0,
windowWidth: 0,
windowHeight: 0,
rootWidth: 0,
rootHeight: 0,
doubleClickTimer: null,
};
},
created() {
mounted() {
this.resize();
},
@@ -96,6 +95,7 @@ export default createComponent({
if (val) {
this.setActive(+this.startPosition);
this.$nextTick(() => {
this.resize();
this.$refs.swipe.swipeTo(+this.startPosition, { immediate: true });
});
} else {
@@ -109,9 +109,10 @@ export default createComponent({
methods: {
resize() {
if (inBrowser) {
this.windowWidth = window.innerWidth;
this.windowHeight = window.innerHeight;
if (this.$el && this.$el.getBoundingClientRect) {
const rect = this.$el.getBoundingClientRect();
this.rootWidth = rect.width;
this.rootHeight = rect.height;
}
},
@@ -174,8 +175,8 @@ export default createComponent({
active={this.active}
maxZoom={this.maxZoom}
minZoom={this.minZoom}
windowWidth={this.windowWidth}
windowHeight={this.windowHeight}
rootWidth={this.rootWidth}
rootHeight={this.rootHeight}
onScale={this.emitScale}
onClose={this.emitClose}
/>