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>

相关推荐
麦麦麦当劳大王9 小时前
【油猴脚本】Boss直聘 岗位职责复制
开发语言·前端·javascript
只睡四小时10 小时前
Three.js Sub-tick:漏判 60.7%→0
开发语言·javascript·性能优化·ecmascript·游戏开发·three.js·碰撞检测
excel11 小时前
基于 GPT 的自动发布文章接口方案:从一句话或一张图片生成并发布内容
前端·javascript·后端
OpsEye17 小时前
大模型 Token 计量不准,是什么原因,怎么解决??
javascript·ai编程
独隅18 小时前
WebStorm Windows 版 React / Next.js 实战替换指南
javascript·windows·webstorm
冷眸_19 小时前
同名食材不能直接相减:一个 JavaScript 用量模型的边界
javascript
ruanno_top19 小时前
倒计时该用 deadline 还是每秒减一?我把两种写法都跑了一遍
vue.js
apollo_qwe19 小时前
接口超时了,前端为什么不能直接重试?
javascript·http
徐小夕1 天前
下载量超 30 万的开源智能体 Prime Agent:它把自己从 TypeScript 重写成了 Rust
前端·vue.js·github
toooooop81 天前
CRMEB 故障排查笔记:安全网关只放行 GET/POST 怎么办
前端·javascript·vue.js·thinkphp6·crmeb