提交 e87bd6b6 编写于 作者: KK's avatar KK

update 抽屉组件

上级 f9545688
...@@ -77,10 +77,7 @@ export class AppDrawer { ...@@ -77,10 +77,7 @@ export class AppDrawer {
} }
}).$mount(); }).$mount();
this.vueExample = vm; this.vueExample = vm;
let app = document.getElementById("app"); document.body.appendChild(vm.$el);
if(app){
app.appendChild(vm.$el);
}
const comp: any = vm.$children[0]; const comp: any = vm.$children[0];
return comp.getSubject(); return comp.getSubject();
} catch (error) { } catch (error) {
...@@ -111,6 +108,7 @@ export class AppDrawer { ...@@ -111,6 +108,7 @@ export class AppDrawer {
} }
} }
/** /**
* 生成uuid * 生成uuid
* *
......
<template> <template>
<div class="drawer"> <div class="drawer">
<div :id="uuid"></div> <van-popup @closed="close" v-model="isShow" :position="placement" :style="{ width:'80%', height: '100%' }" >
<ion-menu
:side="placement"
:content-id="uuid"
:ref="uuid+'drawer'"
@ionDidClose="close"
@on-visible-change="onVisibleChange($event)">
<ion-content>
<component <component
:is="viewname" :is="viewname"
class="viewcontainer2" class="viewcontainer2"
...@@ -19,8 +12,7 @@ ...@@ -19,8 +12,7 @@
@close="close($event)" @close="close($event)"
:ref="viewname"> :ref="viewname">
</component> </component>
</ion-content> </van-popup>
</ion-menu>
</div> </div>
</template> </template>
...@@ -73,6 +65,7 @@ export default class AppDrawerCompponent extends Vue { ...@@ -73,6 +65,7 @@ export default class AppDrawerCompponent extends Vue {
*/ */
public subject: null | Subject<any> = new Subject<any>(); public subject: null | Subject<any> = new Subject<any>();
/** /**
* 抽屉弹出位置 * 抽屉弹出位置
* *
...@@ -89,7 +82,7 @@ export default class AppDrawerCompponent extends Vue { ...@@ -89,7 +82,7 @@ export default class AppDrawerCompponent extends Vue {
* @type {boolean} * @type {boolean}
* @memberof AppDrawerCompponent * @memberof AppDrawerCompponent
*/ */
public isShow: boolean = true; public isShow: boolean = false;
/** /**
* 零时结果 * 零时结果
...@@ -140,7 +133,7 @@ export default class AppDrawerCompponent extends Vue { ...@@ -140,7 +133,7 @@ export default class AppDrawerCompponent extends Vue {
*/ */
public created() { public created() {
this.viewname = this.view.viewname; this.viewname = this.view.viewname;
this.placement = this.view.placement === 'DRAWER_LEFT' ? 'start' : 'end'; this.placement = this.view.placement === 'DRAWER_LEFT' ? 'left' : 'right';
if (this.view.width) { if (this.view.width) {
if (this.view.width.toString().indexOf('px') > 0) { if (this.view.width.toString().indexOf('px') > 0) {
if (!Object.is(this.view.width, '0px')) { if (!Object.is(this.view.width, '0px')) {
...@@ -174,10 +167,6 @@ export default class AppDrawerCompponent extends Vue { ...@@ -174,10 +167,6 @@ export default class AppDrawerCompponent extends Vue {
public mounted() { public mounted() {
this.isShow = true; this.isShow = true;
this.handleZIndex('ivu-drawer-mask', 'ivu-drawer-wrap'); this.handleZIndex('ivu-drawer-mask', 'ivu-drawer-wrap');
let drawer :any = this.$refs[this.uuid+'drawer'];
if(drawer){
drawer.open()
}
} }
/** /**
...@@ -261,7 +250,9 @@ export default class AppDrawerCompponent extends Vue { ...@@ -261,7 +250,9 @@ export default class AppDrawerCompponent extends Vue {
this.isShow = true; this.isShow = true;
const title: any = this.$t('app.tabpage.sureclosetip.title'); const title: any = this.$t('app.tabpage.sureclosetip.title');
const contant: any = this.$t('app.tabpage.sureclosetip.content'); const contant: any = this.$t('app.tabpage.sureclosetip.content');
} }
this.handleShowState(true);
} }
} }
...@@ -276,16 +267,15 @@ export default class AppDrawerCompponent extends Vue { ...@@ -276,16 +267,15 @@ export default class AppDrawerCompponent extends Vue {
} }
if (this.subject) { if (this.subject) {
if (this.tempResult && Object.is(this.tempResult.ret, 'OK')) { if (this.tempResult && Object.is(this.tempResult.ret, 'OK')) {
this.subject.next(this.tempResult);
} }
this.subject.next(this.tempResult);
} }
setTimeout(() => { // setTimeout(() => {
console.log(this.$el) // // document.body.removeChild(this.$el);
document.body.removeChild(this.$el); // this.$destroy();
this.$destroy(); // this.subject = null;
this.subject = null; // }, 500)
}, 500)
} }
} }
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册