115 lines
3.0 KiB
Vue
Executable File
115 lines
3.0 KiB
Vue
Executable File
<template>
|
|
<opsoft-screen-popup :maskShow="true" :maskBackgroundColor="maskBackgroundColor" :maskHideTitle="popupHideTitle"
|
|
:popupStyle="popupStyleReactive" class="opsoft-side-popup" v-bind="$attrs">
|
|
<template v-slot:popupContent>
|
|
<view class="opsoft-side-popup">
|
|
<slot name="sidePopupTitle" :value="popupTitle">
|
|
<view class="opsoft-side-popup-title">{{popupTitle}}</view>
|
|
</slot>
|
|
<slot name="sidePopupContent" :value="popupMenus">
|
|
<view class="opsoft-side-popup-conetnt">
|
|
<opsoft-list :list="popupMenus" v-bind="$attrs"/>
|
|
</view>
|
|
</slot>
|
|
</view>
|
|
</template>
|
|
</opsoft-screen-popup>
|
|
</template>
|
|
|
|
<script>
|
|
import OpsoftScreenPopup from "../opsoft-screen-popup/opsoft-screen-popup.vue";
|
|
import {ref, computed, onMounted, reactive, watch, toRefs, toRef} from "vue";
|
|
export default {
|
|
name: "opsoft-side-popup",
|
|
inheritAttrs: false,
|
|
components: {
|
|
"opsoft-screen-popup":OpsoftScreenPopup,
|
|
},
|
|
props: {
|
|
maskBackgroundColor: {type:String},
|
|
popupTitle: {type:String},
|
|
popupMenus: {type:Array, default:[]},
|
|
popupPosition: {type:String, default:'left'},
|
|
popupHideTitle: {type:Boolean, default:false},
|
|
},
|
|
setup (props, context) {
|
|
const popupShowComputed = computed({
|
|
get() {
|
|
return props.popupShow;
|
|
},
|
|
set(value) {
|
|
context.emit("update:popupShow", value);
|
|
}
|
|
});
|
|
|
|
const popupStyleReactive = reactive({});
|
|
|
|
watch(() => props.popupShow, (newValue)=>{
|
|
if (newValue) {
|
|
//弹出菜单样式变化
|
|
if (props.popupStyle) {
|
|
for (let key in popupStyleReactive) {
|
|
if (!props.popupStyle.hasOwnProperty(key)) {
|
|
delete popupStyleReactive[key];
|
|
}
|
|
}
|
|
Object.assign(popupStyleReactive, props.popupStyle);
|
|
}
|
|
|
|
if (props.popupPosition == 'right') {
|
|
popupStyleReactive.left = '30%';
|
|
}
|
|
else if (props.popupPosition == 'right') {
|
|
popupStyleReactive.left = '0px%';
|
|
}
|
|
}
|
|
});
|
|
|
|
onMounted(() => {
|
|
if (props.popupStyle) {
|
|
Object.assign(popupStyleReactive, props.popupStyle);
|
|
}
|
|
|
|
popupStyleReactive.top = '0px';
|
|
popupStyleReactive.left = '0px';
|
|
popupStyleReactive.width = '70%';
|
|
popupStyleReactive.height = '100%';
|
|
popupStyleReactive.backgroundColor = '#FFFFFF';
|
|
if (props.popupPosition == 'right') {
|
|
popupStyleReactive.left = '30%';
|
|
}
|
|
console.log(props.popupMenus);
|
|
});
|
|
|
|
return {
|
|
popupShowComputed,
|
|
popupStyleReactive,
|
|
};
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.opsoft-screen-popup{
|
|
.opsoft-side-popup {
|
|
background: rgba(255, 255, 255, 1);
|
|
margin: 24rpx 0rpx 24rpx 0rpx;
|
|
height: 100%;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
.opsoft-side-popup-title {
|
|
margin: 24rpx 24rpx 0rpx 24rpx;
|
|
height: 44rpx;
|
|
color: rgba(51, 51, 51, 1);
|
|
font-size: 32rpx;
|
|
line-height: 44rpx;
|
|
}
|
|
.opsoft-side-popup-conetnt {
|
|
height: 100%;
|
|
width: 100%;
|
|
overflow-y: scroll;
|
|
}
|
|
}
|
|
}
|
|
|
|
</style> |