Browse Source

feat: popup增加popClass属性

suzigang 5 years ago
parent
commit
e51abd66d8
3 changed files with 12 additions and 2 deletions
  1. 4 1
      src/packages/popup/demo.vue
  2. 1 0
      src/packages/popup/doc.md
  3. 7 1
      src/packages/popup/index.vue

+ 4 - 1
src/packages/popup/demo.vue

@@ -6,7 +6,10 @@
       is-link
       @click="state.showBasic = true"
     ></nut-cell>
-    <nut-popup :style="{ padding: '30px 50px' }" v-model:show="state.showBasic"
+    <nut-popup
+      popClass="popclass"
+      :style="{ padding: '30px 50px' }"
+      v-model:show="state.showBasic"
       >正文</nut-popup
     >
     <h2>弹出位置</h2>

+ 1 - 0
src/packages/popup/doc.md

@@ -103,6 +103,7 @@ app.use(Popup);
 | position               | 弹出位置(top,bottom,left,right,center)                    | String         | "center"    |
 | transition             | 动画名                                                      | String         | -           |
 | style                  | 自定义弹框样式                                              | CSSProperties  | -           |
+| pop-class               | 自定义弹框类名                    | String         | -    |
 | closeable              | 是否显示关闭按钮                                            | Boolean        | true        |
 | close-icon-position    | 关闭按钮位置(top-left,top-right,bottom-left,bottom-right) | String         | "top-right" |
 | close-icon             | 自定义 Icon                                                 | String         | "close"     |

+ 7 - 1
src/packages/popup/index.vue

@@ -68,6 +68,11 @@ const popupProps = {
     type: Object as PropType<CSSProperties>
   },
 
+  popClass: {
+    type: String,
+    default: ''
+  },
+
   closeable: {
     type: Boolean,
     default: false
@@ -134,7 +139,8 @@ export default create({
       return {
         [prefixCls]: true,
         ['round']: props.round,
-        [`popup-${props.position}`]: true
+        [`popup-${props.position}`]: true,
+        [props.popClass]: true
       };
     });