# biz-dialog 弹窗

# 基本用法

在需要使用弹窗的文件中声明 hos-biz-dialog组件,同时存在多个时设置 uid 属性。uid 属性需在项目中保持唯一性,推荐使用 项目名-功能名-dialog 来命名。

<!-- 声明组件 -->
<hos-biz-dialog />

<!-- 声明带 uid 的组件 -->
<hos-biz-dialog uid="dialog1"/>

dialog 组件仅提供容器,使用xuex命令控制组件的显示与隐藏。需使用component指定容器中的组件。可设置uid指定 dialog 。使用 props 向 dialog 容器内组件传参。


// 显示dialog
this.$store.commit('OPEN_DIALOG',{
  component: require('./dialog/form1.vue').default
});

// 显示指定dialog

this.$store.commit('OPEN_DIALOG',{
  component: require('./dialog/form1.vue').default,
  _uid: 'dialog1'
});

// 显示指定dialog并传递参数

this.$store.commit('OPEN_DIALOG',{
  component: require('./dialog/form1.vue').default,
  _uid: 'dialog1',
  props: {
    name: '张三',
    age: 18
  }
});

// 关闭dialog

this.$store.commit('CLOSE_DIALOG');

// 关闭指定dialog

this.$store.commit('CLOSE_DIALOG', {_uid: 'dialog1'})
  

    


# attributes (默认继承 hos-dialog 所有属性,这里只列举额外属性)

参数 说明 类型 可选值 默认值
_uid uid(项目中需保持唯一) string/number - 0
component 容器内的组件 component -
props 组件接收的数据 - -