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>

相关推荐
Highcharts.js13 小时前
缺失数据可视化图表开发实战|Highcharts创建人员出生统计面积图表示例
开发语言·前端·javascript·信息可视化·highcharts·图表开发
涵涵(互关)1 天前
Naive-ui树型选择器只显示根节点
前端·ui·vue
放下华子我只抽RuiKe51 天前
React 从入门到生产(四):自定义 Hook
前端·javascript·人工智能·深度学习·react.js·自然语言处理·前端框架
XinZong1 天前
OpenClaw 实现双重心跳(Heartbeat)+ clawreach虾聊项目实现
javascript
还有多久拿退休金1 天前
一张栈的图,治好你面试答不出 script 阻塞的病
前端·javascript
zithern_juejin1 天前
原型与原型链
javascript
测试员周周1 天前
【Appium 系列】第13节-混合测试执行器 — API + UI 的协同执行
开发语言·人工智能·python·功能测试·ui·appium·pytest
莽夫搞战术1 天前
【Google Stitch】AI原生画布重新定义设计,让想法变成可交互界面
前端·人工智能·ui
还有多久拿退休金1 天前
我用 Three.js 造了个 3D 漫步世界,角色走路像喝醉了——以及我是怎么修好的
前端·vue.js
LJA648441 天前
为什么 AI 时代更需要配置化组件库
vue.js