app-mob-context-menu.vue 980 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<template>
    <van-popup class="app-mob-context-menu"  v-model="isShow" :get-container="eleContainer" >
        <slot  name="app-mob-context-menu__content"></slot>
    </van-popup>
</template>
<script lang="ts">
import { Vue, Component, Prop} from "vue-property-decorator";
@Component({
    components: {},
})
export default class appMobContextMenu extends Vue {

    /**
     * 上下文菜单显示状态
     *
     * @type {*}
     * @memberof appMobContextMenu
     */
    public isShow :boolean = false;

    /**
     * 指定挂载节点  默认为#app
     *
     * @type {*}
     * @memberof appMobContextMenu
     */
    @Prop({default:'#app'}) public eleContainer?:any;

    /**
     * 打开上下文菜单
     *
     * @type {*}
     * @memberof appMobContextMenu
     */
    public openContextMenu(){
        this.isShow = true;
    }

    /**
     * 关闭上下文菜单
     */
    public closeContextMenu() {
        this.isShow = false;
    }
    
}
</script>