[!] web端才有平移效果
diff --git a/packages/wxc-dialog/index.vue b/packages/wxc-dialog/index.vue
index 73049b9..fa21e6a 100644
--- a/packages/wxc-dialog/index.vue
+++ b/packages/wxc-dialog/index.vue
@@ -5,7 +5,7 @@
<template>
<div class="container">
<wxc-overlay :left='left' v-if="show" :show="true" :hasAnimation="false"></wxc-overlay>
- <div class="dialog-box" v-if="show" :style="{top:top+'px', left: (left + 96) + 'px'}">
+ <div class="dialog-box" v-if="show" :style="{top:top+'px', left: ((isWeb ? left : 0) + 96) + 'px'}">
<div class="dialog-content">
<slot name="title">
<text class="content-title">{{title}}</text>
@@ -118,6 +118,7 @@
<script>
import WxcOverlay from '../wxc-overlay'
import { CHECKED, UN_CHECKED } from './type';
+ import Utils from '../utils';
export default {
components: { WxcOverlay },
@@ -177,7 +178,8 @@
},
data: () => ({
noPromptIcon: UN_CHECKED,
- pageHeight: 1334
+ pageHeight: 1334,
+ isWeb: Utils.env.isWeb()
}),
created () {
const { env: { deviceHeight, deviceWidth } } = weex.config;
diff --git a/packages/wxc-overlay/index.vue b/packages/wxc-overlay/index.vue
index aa96a75..60659a0 100644
--- a/packages/wxc-overlay/index.vue
+++ b/packages/wxc-overlay/index.vue
@@ -9,7 +9,7 @@
v-if="show"
:hack="shouldShow"
@click="overlayClicked"
- :style="Object.assign({left: left + 'px'} ,overlayStyle)">
+ :style="overlayStyle">
</div>
</div>
</template>
@@ -26,6 +26,8 @@
<script>
const animation = weex.requireModule('animation');
+ import Utils from '../utils';
+
export default {
props: {
show: {
@@ -61,7 +63,8 @@
overlayStyle () {
return {
opacity: this.hasAnimation ? 0 : 1,
- backgroundColor: `rgba(0, 0, 0,${this.opacity})`
+ backgroundColor: `rgba(0, 0, 0,${this.opacity})`,
+ left: Utils.env.isWeb() ? this.left + 'px' : 0
}
},
shouldShow () {