美文网首页让前端飞前端组件库
前端自定义弹框、自定义弹框内容alertView popup组件

前端自定义弹框、自定义弹框内容alertView popup组件

作者: 前端组件分享 | 来源:发表于2023-05-17 20:29 被阅读0次

快速实现前端自定义弹框、自定义弹框内容alertView popup组件, 请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=12491

效果图如下:

代码如下:

# 自定义弹框使用方法

#### HTML代码部分

```html

<template>

<view class="content">

<image class="logo" src="/static/logo.png"></image>

<view class="logo" style="background-color: aquamarine;line-height: 100px;text-align: center;" @click="popupClick">点击弹框</view>

<!-- 使用组件 -->

<ccPopup :ishide='isshow' width="calc(100vw - 70px)" height="346px" radius="16rpx">

<!-- 自定义展示内容 -->

<view class="modelContent">

<view style="margin-top: 6px;">

弹框标题

</view>

<view style="margin-top: 20px; color: #666666; margin: 6px 12px;">

这是弹框内容 这是弹框内容 这是弹框内容 这是弹框内容

</view>

<image class="imageV" :src="mySrc" ></image>

</view>

<!-- 自定义关闭按钮 -->

<view class="close" @click="isshow=false">✕</view>

</ccPopup>

</view>

</template>

```

#### JS代码 (引入组件 填充数据)

```javascript

<script>

import ccPopup from '@/components/cc-popup.vue';

export default {

components: {

ccPopup

},

data() {

return {

title: 'Hello',

companyList:[{},{},{}],

isshow:false,

mySrc:'../../static/logo.png'

}

},

onLoad() {

},

methods: {

popupClick(){

this.isshow = !this.isshow;

}

}

}

</script>

```

#### CSS

```CSS

<style>

.content {

display: flex;

flex-direction: column;

}

.logo {

height: 200rpx;

width: 200rpx;

margin-top: 200rpx;

margin-left: auto;

margin-right: auto;

margin-bottom: 50rpx;

}

.text-area {

display: flex;

justify-content: center;

}

.title {

font-size: 36rpx;

color: #8f8f94;

}

.modelContent {

width: 100%;

height: 100%;

display: flex;

align-items: center;

flex-direction: column;

justify-content: center;

}

.imageV {

margin-top: 0px;

width: calc(100vw - 100px);

height: calc((100vw - 100px) * 1.027) ;

}

.close {

width: 60rpx;

height: 60rpx;

color: #FFFFFF;

line-height: 60rpx;

text-align: center;

border-radius: 50%;

border: 1px solid #FFFFFF;

position: relative;

bottom: -10%;

left: 50%;

transform: translate(-50%, -50%);

}

</style>

```

相关文章

网友评论

    本文标题:前端自定义弹框、自定义弹框内容alertView popup组件

    本文链接:https://www.haomeiwen.com/subject/cpoisdtx.html