单独弹窗

<el-button type="text" @click="dialogVisible = true">点击打开 Dialog</el-button>

<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
  <span>这是一段信息</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="handleClose">取 消</el-button>
    <el-button type="primary" @click="dialogVisibleYes">确 定</el-button>
  </span>
</el-dialog>

<script>
export default {
	data() {
		return {
			title: ' ', //弹出层标题
			dialogVisible: false //是否显示弹出层
		};
	},
	methods: {
		//取消弹窗
		handleClose(done) {
			this.dialogVisible = true;
		},
		//弹窗确定
		dialogVisibleYes() {}
	}
};
</script>

弹窗套表单

<el-button type="text" @click="dialogVisible = true">点击打开 Dialog</el-button>

<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
 <el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="flag=='look'">
            <el-row :gutter='20'>
              <el-col :span="12">
                <el-form-item label="发布平台" prop="publishingPlatform">
                  <el-select v-model="form.publishingPlatform" placeholder="请选择" clearable :disabled="flag=='look'">
                    <el-option v-for="dict in dict.type.publishing_platform" :key="dict.value" :label="dict.label" :value="dict.value" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="创建人" prop="userId">
                  <el-select v-model="form.userId" placeholder="请选择" clearable filterable @change="$forceUpdate()" :disabled="flag=='look'">
                    <el-option v-for="dict in userList" :key="dict.userId" :label="dict.nickName" :value="dict.userId" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发布时间" prop="creationTime">
                  <el-date-picker v-model="form.creationTime" type="date" placeholder="请选择发布时间" value-format="yyyy-MM-dd">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发布部门" prop="deptId">
                  <el-select v-model="form.deptId" placeholder="请选择发布部门" clearable @change="$forceUpdate()">
                    <el-option v-for="item in defaultDpt" :key="item.deptId" :value="item.deptId" :label="item.deptName"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="数量" prop="quantity">
                  <el-input v-model="form.quantity" placeholder="请输入发布数量" style="width: 220px;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="备注" prop="remarks">
                  <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>

  <span slot="footer" class="dialog-footer">
    <el-button @click="handleClose">取 消</el-button>
    <el-button type="primary" @click="dialogVisibleYes">确 定</el-button>
  </span>
</el-dialog>

<script>
export default {
	data() {
		return {
			title: ' ', //弹出层标题
			dialogVisible: false //是否显示弹出层
		};
	},
	methods: {
		//取消弹窗
		handleClose(done) {
			this.dialogVisible = true;
		},
		//弹窗确定
		dialogVisibleYes() {}
	}
};
</script>

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐