浏览代码

docs(popup): add international en-us

suzigang 3 年之前
父节点
当前提交
3725af0d90
共有 3 个文件被更改,包括 255 次插入20 次删除
  1. 56 19
      src/packages/__VUE/popup/demo.vue
  2. 199 0
      src/packages/__VUE/popup/doc.en-US.md
  3. 0 1
      src/packages/__VUE/popup/doc.md

+ 56 - 19
src/packages/__VUE/popup/demo.vue

@@ -1,23 +1,27 @@
 <template>
   <div class="demo">
-    <h2>基础用法</h2>
-    <nut-cell title="展示弹出层" is-link @click="state.showBasic = true"></nut-cell>
-    <nut-popup pop-class="popclass" :style="{ padding: '30px 50px' }" v-model:visible="state.showBasic" :z-index="100"
-      >正文</nut-popup
+    <h2>{{ translate('basic') }}</h2>
+    <nut-cell :title="translate('cell1')" is-link @click="state.showBasic = true"></nut-cell>
+    <nut-popup
+      pop-class="popclass"
+      :style="{ padding: '30px 50px' }"
+      v-model:visible="state.showBasic"
+      :z-index="100"
+      >{{ translate('text') }}</nut-popup
     >
-    <h2>弹出位置</h2>
-    <nut-cell title="顶部弹出" is-link @click="state.showTop = true"></nut-cell>
+    <h2>{{ translate('position') }}</h2>
+    <nut-cell :title="translate('cell2')" is-link @click="state.showTop = true"></nut-cell>
     <nut-popup position="top" :style="{ height: '20%' }" v-model:visible="state.showTop"></nut-popup>
-    <nut-cell title="底部弹出" is-link @click="state.showBottom = true"></nut-cell>
+    <nut-cell :title="translate('cell3')" is-link @click="state.showBottom = true"></nut-cell>
     <nut-popup position="bottom" :style="{ height: '20%' }" v-model:visible="state.showBottom"></nut-popup>
-    <nut-cell title="左侧弹出" is-link @click="state.showLeft = true"></nut-cell>
+    <nut-cell :title="translate('cell4')" is-link @click="state.showLeft = true"></nut-cell>
     <nut-popup position="left" :style="{ width: '20%', height: '100%' }" v-model:visible="state.showLeft"></nut-popup>
-    <nut-cell title="右侧弹出" is-link @click="state.showRight = true"></nut-cell>
+    <nut-cell :title="translate('cell5')" is-link @click="state.showRight = true"></nut-cell>
     <nut-popup position="right" :style="{ width: '20%', height: '100%' }" v-model:visible="state.showRight"></nut-popup>
-    <h2>关闭图标</h2>
-    <nut-cell title="关闭图标" is-link @click="state.showIcon = true"></nut-cell>
+    <h2>{{ translate('close') }}</h2>
+    <nut-cell :title="translate('close')" is-link @click="state.showIcon = true"></nut-cell>
     <nut-popup position="bottom" closeable :style="{ height: '20%' }" v-model:visible="state.showIcon"></nut-popup>
-    <nut-cell title="图标位置" is-link @click="state.showIconPosition = true"></nut-cell>
+    <nut-cell :title="translate('iposition')" is-link @click="state.showIconPosition = true"></nut-cell>
     <nut-popup
       position="bottom"
       closeable
@@ -25,7 +29,7 @@
       :style="{ height: '20%' }"
       v-model:visible="state.showIconPosition"
     ></nut-popup>
-    <nut-cell title="自定义图标" is-link @click="state.showCloseIcon = true"></nut-cell>
+    <nut-cell :title="translate('cicon')" is-link @click="state.showCloseIcon = true"></nut-cell>
     <nut-popup
       position="bottom"
       closeable
@@ -34,8 +38,8 @@
       :style="{ height: '20%' }"
       v-model:visible="state.showCloseIcon"
     ></nut-popup>
-    <h2>圆角弹框</h2>
-    <nut-cell title="圆角弹框" is-link @click="state.showRound = true"></nut-cell>
+    <h2>{{ translate('circle') }}</h2>
+    <nut-cell :title="translate('circle')" is-link @click="state.showRound = true"></nut-cell>
     <nut-popup
       position="bottom"
       closeable
@@ -43,8 +47,8 @@
       :style="{ height: '30%' }"
       v-model:visible="state.showRound"
     ></nut-popup>
-    <h2>指定挂载节点</h2>
-    <nut-cell title="指定挂载节点" is-link @click="state.showTeleport = true"></nut-cell>
+    <h2>{{ translate('teleport') }}</h2>
+    <nut-cell :title="translate('teleport')" is-link @click="state.showTeleport = true"></nut-cell>
     <nut-popup :style="{ padding: '30px 50px' }" teleport="#app" v-model:visible="state.showTeleport">app</nut-popup>
   </div>
 </template>
@@ -52,7 +56,40 @@
 <script lang="ts">
 import { reactive } from 'vue';
 import { createComponent } from '@/packages/utils/create';
-const { createDemo } = createComponent('popup');
+const { createDemo, translate } = createComponent('popup');
+import { useTranslate } from '@/sites/assets/util/useTranslate';
+useTranslate({
+  'zh-CN': {
+    basic: '基本用法',
+    cell1: '展示弹出层',
+    text: '正文',
+    position: '弹出位置',
+    cell2: '顶部弹出',
+    cell3: '底部弹出',
+    cell4: '左侧弹出',
+    cell5: '右侧弹出',
+    close: '关闭图标',
+    iposition: '图标位置',
+    cicon: '自定义图标',
+    circle: '圆角弹框',
+    teleport: '指定挂载节点'
+  },
+  'en-US': {
+    basic: 'Basic Usage',
+    cell1: 'Show pop-up layer',
+    text: 'text',
+    position: 'Eject position',
+    cell2: 'Top pop-up',
+    cell3: 'Bottom pop-up',
+    cell4: 'Left pop-up',
+    cell5: 'Right pop-up',
+    close: 'Close icon',
+    iposition: 'Icon location',
+    cicon: 'Custom icon',
+    circle: 'Rounded bullet frame',
+    teleport: 'Specify mount node'
+  }
+});
 export default createDemo({
   props: {},
   setup() {
@@ -68,7 +105,7 @@ export default createDemo({
       showRound: false,
       showCombination: false
     });
-    return { state };
+    return { state, translate };
   }
 });
 </script>

+ 199 - 0
src/packages/__VUE/popup/doc.en-US.md

@@ -0,0 +1,199 @@
+# Popup
+
+### Intro
+
+The pop-up layer container is used to display pop-up windows, information prompts and other contents, and supports the superposition display of multiple pop-up layers
+
+### Install
+
+```javascript
+import { createApp } from 'vue';
+//vue
+import { Popup,OverLay } from '@nutui/nutui';
+//taro
+import { Popup,OverLay } from '@nutui/nutui-taro';
+
+const app = createApp();
+app.use(Popup).use(OverLay)
+```
+
+### Basic Usage
+
+`visible` Control show / hide
+
+:::demo
+
+```html
+<template>
+  <nut-cell title="Show pop-up layer" is-link @click="state.showBasic = true"></nut-cell>
+  <nut-popup pop-class="popclass" :style="{ padding: '30px 50px' }" v-model:visible="state.showBasic" :z-index="100">text</nut-popup>
+</template>
+<script lang="ts">
+  import { reactive } from 'vue';
+  export default {
+    props: {},
+    setup() {
+      const state = reactive({
+        showBasic: false
+      });
+      return { state };
+    }
+  };
+</script>
+```
+
+:::
+
+### Eject position
+
+:::demo
+
+```html
+<template>
+  <nut-cell title="Top pop-up" is-link @click="state.showTop = true"></nut-cell>
+  <nut-popup position="top" :style="{ height: '20%' }" v-model:visible="state.showTop"></nut-popup>
+  <nut-cell title="Bottom pop-up" is-link @click="state.showBottom = true"></nut-cell>
+  <nut-popup position="bottom" :style="{ height: '20%' }" v-model:visible="state.showBottom"></nut-popup>
+  <nut-cell title="Left pop-up" is-link @click="state.showLeft = true"></nut-cell>
+  <nut-popup position="left" :style="{ width: '20%', height: '100%' }" v-model:visible="state.showLeft"></nut-popup>
+  <nut-cell title="Right pop-up" is-link @click="state.showRight = true"></nut-cell>
+  <nut-popup position="right" :style="{ width: '20%', height: '100%' }" v-model:visible="state.showRight"></nut-popup>
+</template>
+<script lang="ts">
+  import { reactive } from 'vue';
+  export default {
+    props: {},
+    setup() {
+      const state = reactive({
+        showTop: false,
+        showBottom: false,
+        showLeft: false,
+        showRight: false,
+      });
+      return { state };
+    }
+  };
+</script>
+```
+
+:::
+
+### Icon
+
+
+:::demo
+
+```html
+<template>
+  <nut-cell title="Close icon" is-link @click="state.showIcon = true"></nut-cell>
+  <nut-popup position="bottom" closeable :style="{ height: '20%' }" v-model:visible="state.showIcon"></nut-popup>
+  <nut-cell title="Icon location" is-link @click="state.showIconPosition = true" ></nut-cell>
+  <nut-popup position="bottom" closeable close-icon-position="top-left" :style="{ height: '20%' }" v-model:visible="state.showIconPosition" ></nut-popup>
+  <nut-cell title="Custom icon" is-link @click="state.showCloseIcon = true" ></nut-cell>
+  <nut-popup position="bottom" closeable close-icon-position="top-left" close-icon="heart" :style="{ height: '20%' }" v-model:visible="state.showCloseIcon"></nut-popup>
+</template>
+<script lang="ts">
+  import { reactive } from 'vue';
+  export default {
+    props: {},
+    setup() {
+      const state = reactive({
+        showIcon: false,
+        showIconPosition: false,
+        showCloseIcon: false,
+      });
+      return { state };
+    }
+  };
+</script>
+```
+
+:::
+
+### Rounded bullet frame
+
+:::demo
+
+```html
+<template>
+  <nut-cell title="Rounded pop-up" is-link @click="state.showRound = true"></nut-cell>
+  <nut-popup position="bottom" closeable round :style="{ height: '30%' }" v-model:visible="state.showRound"></nut-popup>
+</template>
+<script lang="ts">
+  import { reactive } from 'vue';
+  export default {
+    props: {},
+    setup() {
+      const state = reactive({
+        showRound: false,
+      });
+      return { state };
+    }
+  };
+</script>
+```
+
+:::
+
+### Specify mount node
+
+:::demo
+
+```html
+<template>
+  <nut-cell title="Specify mount node" is-link @click="state.showTeleport = true"></nut-cell>
+  <nut-popup :style="{ padding: '30px 50px' }" teleport="#app" v-model:visible="state.showTeleport" >app</nut-popup>
+</template>
+<script lang="ts">
+  import { reactive } from 'vue';
+  export default {
+    props: {},
+    setup() {
+      const state = reactive({
+        showTeleport: false,
+      });
+      return { state };
+    }
+  };
+</script>
+```
+
+:::
+
+## API
+
+### Props
+
+| Attribute                   | Description                                                        | Type           | Default        |
+|------------------------|-------------------------------------------------------------|----------------|---------------|
+| v-model:visible        | Whether the current component is displayed                  | Boolean        | `false`       |
+| z-index                | Mask level                                                    | String、Number | `2000`        |
+| duration               | Animation duration,Unit second                                         | String、Number | `0.3`         |
+| overlay-class          | Custom mask classname                                              | String         | -             |
+| overlay-style          | Custom mask style                                             | CSSProperties  | -             |
+| lock-scroll            | Whether the background is locked                                                | Boolean        | `true`       |
+| overlay                | Show mask                                                | Boolean        | `true`        |
+| close-on-click-overlay | Click to close the mask                                            | Boolean        | `true`        |
+| position               | Eject position(top,bottom,left,right,center)                    | String         | `"center"`    |
+| transition             | Animation name                                                      | String         | -             |
+| style                  | Custom pop-up style                                              | CSSProperties  | -             |
+| pop-class              | Custom bullet box classname                                              | String         | -             |
+| closeable              | Show close button                                           | Boolean        | `false`        |
+| close-icon-position    | Close button position(top-left,top-right,bottom-left,bottom-right) | String         | `"top-right"` |
+| close-icon             | Custom Icon                                                 | String         | `"close"`     |
+| destroy-on-close       | Will the contents of `slot` be cleared after the bullet layer is closed   | Boolean        | `true`        |
+| round                  | Show fillet                                                | Boolean        | `false`       |
+| teleport               | Specify the mount node (`not supported by miniProgram')   | String         | `"body"`      |
+| safe-area-inset-bottom `v3.1.19`	| Whether to enable iPhone series full screen bottom safety zone adaptation, which is only valid when `position` is  `bottom` |	Boolean	|`false`     |
+
+### Events
+
+| Event | Description                  | Arguments   |
+|------------------|------------------------|----------------|
+| click            | Triggered when the pop-up box is clicked         | `event: Event` |
+| click-close-icon | Triggered when the close icon is clicked     | `event: Event` |
+| open             | Triggered when the pop-up box is opened         | -              |
+| close            | Triggered when the pop-up box is closed         | -              |
+| opend            | Triggered at the end of the mask open animation | `event: Event` |
+| closed           | Triggered when the mask closes and the animation ends | `event: Event` |
+| click-overlay    | Click mask trigger           | `event: Event` |

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

@@ -17,7 +17,6 @@ const app = createApp();
 app.use(Popup).use(OverLay)
 ```
 
-## 代码演示
 
 ### 基础用法