el-dialog element-ui弹窗

bulkImport.vue 自定义组件

<template>

<el-dialog :visible="modalVisible" title="批量导入" centered @close="$emit('close')" :fullscreen="true">

<span>弹窗内容</span>

<span slot="footer" class="dialog-footer">

<el-button @click="closeModal">取 消</el-button>

<el-button type="primary" @click="onConfirm">确 定</el-button>

</span>

</el-dialog>

</template>

<script>

export default {

props: {

// modal是否可见

modalVisible: {

type: Boolean,

default: false,

},

},

data() {

return {};

},

methods: {

onConfirm() {

this.$emit('bulkImport', {'aa':111,'bb':222});

},

closeModal() {

this.$emit('close');

},

},

watch: {},

computed: {},

components: {},

mounted() {},

};

</script>

<style lang="less" scoped>

</style>

================================================================

调用页面:

<template>

<div>

<el-button type="primary" @click="addTags()">批量导入</el-button>

<!-- 批量导入 -->

<bulkImport

@bulkImport="onBulkImport"

@close="() => (bulkImportVisible = false)"

:modalVisible="bulkImportVisible"

/>

</div>

</template>

<script>

//import bulkImport from '@/components/bulkImport.vue';

import bulkImport from '../../components/bulkImport.vue';

export default {

props: {

// modal是否可见

modalVisible: {

type: Boolean,

default: false,

},

},

components: {

bulkImport,

},

data() {

return {

bulkImportVisible: false,

};

},

methods: {

addTags() {

// 打开弹窗

this.bulkImportVisible = true;

},

onBulkImport(e) {

uni.showToast({

title:JSON.stringify(e),

icon: 'none',

duration: 5000

})

console.log(e); // 11

// 关闭弹窗

this.bulkImportVisible = false;

},

},

watch: {},

computed: {},

mounted() {},

};

</script>

<style>

</style>

相关推荐
兰亭妙微UI设计公司2 分钟前
兰亭妙微交互设计公司:从4个方面聊聊UI设计规范
ui·设计规范
今年下半年4 分钟前
【前端】Vue2 项目 ECharts 统计图表组件封装与使用实践(附组件源码)
前端·javascript·echarts
冒险的豆子9 分钟前
JS 原型链 通俗易懂 解释说明(类比 关系)
开发语言·javascript·原型模式
西索斯coding13 分钟前
在 中接入 教程:p配置、m填写、扩展思考参数一篇就够(2)
java·前端·javascript·ai
特立独行的猫A29 分钟前
仓颉UI开发实战:我用仓颉写了个桌面版力扣:从判题机到 100 道题
vue.js
用户17335980753732 分钟前
纯前端 PDF 双面打印避坑指南:翻页顺序错了整个白印?
前端·javascript·vue.js
SensorFlow37 分钟前
从神策 SDK 迁移到 SensorFlow:采集层平滑迁移实战
javascript
空堂与归1 小时前
Gemini 4 Argon 发布:物理推理模型控机器人?
人工智能·gpt·ui·ai·机器人
浮生望2 小时前
从作用域链到 React 陈旧闭包:为什么函数式更新能拿到最新 state
javascript
怕浪猫2 小时前
前端转全栈最低成本的技术栈选择
前端·javascript·面试