浏览代码

fix:dialog修复 textbox 文案修复

guoxiao158 5 年之前
父节点
当前提交
a2af185cf8
共有 5 个文件被更改,包括 56 次插入63 次删除
  1. 2 21
      src/packages/dialog/demo.vue
  2. 48 33
      src/packages/dialog/dialog.vue
  3. 2 2
      src/packages/dialog/doc.md
  4. 3 6
      src/packages/textbox/doc.md
  5. 1 1
      src/packages/toast/demo.vue

+ 2 - 21
src/packages/dialog/demo.vue

@@ -75,26 +75,7 @@
       
       <a href="javascript:;" @click="dialogShow=false" :noCancelBtn="true">点我可以直接关闭对话框</a>
     </nut-dialog>
-    <nut-actionsheet :is-visible="isEditor" > 
-      <div slot="custom"> 
-        <nut-cell title="选择货品" :showIcon="true" :isLink="true" @click.native="isItem=true"> 
-          <div slot="desc" class="selected-option">{{item.name!='' ? item.name : '请选择'}}</div>
-        </nut-cell> 
-        <nut-cell :isLink="true" > 
-          <div slot="title" class="selected-option">
-          <nut-textinput v-model="item.num" :hasBorder="false" placeholder="请输入数量" :clearBtn="true" :disabled="false"/> </div> 
-        </nut-cell>
-        <nut-cell :isLink="true" > 
-           <div slot="title" class="selected-option"> 
-             <nut-textinput v-model="item.price" :hasBorder="false" placeholder="请输入价格" :clearBtn="true" :disabled="false"/> 
-          </div> 
-        </nut-cell> 
-        <nut-buttongroup shape="circle" style="margin-top:10px;padding:10px;">
-           <nut-button color="#333" style="background:#eee" @click.native="isEditor=false"> 取消 </nut-button> 
-           <nut-button style="background:#42b983" @click.native="addItem"> 确定 </nut-button> 
-        </nut-buttongroup>
-      </div> 
-    </nut-actionsheet>
+   
   </div>
 </template>
 
@@ -107,7 +88,7 @@ export default {
   data() {
     return {
       dialogShow: false,
-      isEditor:true,
+      isEditor:false,
       item:{
         
       }

+ 48 - 33
src/packages/dialog/dialog.vue

@@ -54,7 +54,7 @@
   </div>
 </template>
 <script>
-import locale from "../../mixins/locale";
+import locale from '../../mixins/locale';
 
 const lockMaskScroll = (bodyCls => {
   let scrollTop;
@@ -63,7 +63,7 @@ const lockMaskScroll = (bodyCls => {
       scrollTop =
         document.scrollingElement.scrollTop || document.body.scrollTop;
       document.body.classList.add(bodyCls);
-      document.body.style.top = -scrollTop + "px";
+      document.body.style.top = -scrollTop + 'px';
     },
     beforeClose: function() {
       if (document.body.classList.contains(bodyCls)) {
@@ -72,29 +72,35 @@ const lockMaskScroll = (bodyCls => {
       }
     }
   };
-})("dialog-open");
+})('dialog-open');
 
 export default {
-  name: "nut-dialog",
+  name: 'nut-dialog',
   mixins: [locale],
   props: {
     id: {
-      default: ""
+      type: String,
+      default: ''
     },
     title: {
-      default: ""
+       type: String,
+      default: ''
     },
     content: {
-      default: ""
+       type: String,
+      default: ''
     },
     type: {
-      default: ""
+       type: String,
+      default: ''
     },
     link: {
-      default: ""
+       type: String,
+      default: ''
     },
     imgSrc: {
-      default: ""
+       type: String,
+      default: ''
     },
     animation: {
       type: Boolean,
@@ -129,10 +135,12 @@ export default {
       default: false
     },
     cancelBtnTxt: {
-      default: ""
+       type: String,
+      default: ''
     },
     okBtnTxt: {
-      default: ""
+       type: String,
+      default: ''
     },
     okBtnDisabled: {
       type: Boolean,
@@ -143,28 +151,36 @@ export default {
       default: true
     },
     textAlign: {
-      default: "center"
+      type: String,
+      default: 'center'
     },
     onOkBtn: {
+      type: Object,
       default: null
     },
     onCloseBtn: {
+      type: Object,
       default: null
     },
     onCancelBtn: {
+      type: Object,
       default: null
     },
     closeCallback: {
+      type: Object,
       default: null
     },
     onClickImageLink: {
+      type: Object,
       default: null
     },
     maskBgStyle: {
-      default: ""
+      type: String,
+      default: ''
     },
     customClass: {
-      default: ""
+      type: String,
+      default: ''
     }
   },
   data() {
@@ -174,14 +190,14 @@ export default {
   },
   methods: {
     modalClick() {
-      if (!this.closeOnClickModal) return;
-      this.close("modal");
+      if (!this.closeOnClickModal) {return};
+      this.close('modal');
     },
     close(target) {
-      this.$emit("close", target);
-      this.$emit("close-callback", target);
+      this.$emit('close', target);
+      this.$emit('close-callback', target);
       if (
-        typeof this.closeCallback === "function" &&
+        typeof this.closeCallback === 'function' &&
         this.closeCallback(target) === false
       ) {
         return;
@@ -189,8 +205,8 @@ export default {
       this.curVisible = false;
     },
     okBtnClick() {
-      this.$emit("ok-btn-click");
-      if (typeof this.onOkBtn === "function") {
+      this.$emit('ok-btn-click');
+      if (typeof this.onOkBtn === 'function') {
         this.onOkBtn.call(this);
       }
     },
@@ -198,27 +214,26 @@ export default {
       if(!autoClose){
         return
       }
-      this.$emit("cancel-btn-click");
-      if (typeof this.onCancelBtn === "function") {
-        if (this.onCancelBtn.call(this) === false) return;
+      this.$emit('cancel-btn-click');
+      if (typeof this.onCancelBtn === 'function') {
+        if (this.onCancelBtn.call(this) === false) {return};
       }
-      this.close("cancelBtn");
+      this.close('cancelBtn');
          
     },
     closeBtnClick() {
-      if (typeof this.onCloseBtn === "function") {
-        if (this.onCloseBtn.call(this) === false) return;
+      if (typeof this.onCloseBtn === 'function') {
+        if (this.onCloseBtn.call(this) === false) {return};
       }
-      this.close("closeBtn");
+      this.close('closeBtn');
     },
     //图片类型弹窗中的链接点击事件,默认跳转
     imageLinkClick() {
       if (this.onClickImageLink && this.onClickImageLink.call(this) === false)
-        return;
-      if (this.link) location.href = this.link;
+       { return};
+      if (this.link) {location.href = this.link};
     }
   },
-  created() {},
   watch: {
     visible: {
       handler(val) {
@@ -229,7 +244,7 @@ export default {
     curVisible(val) {
       if (this.lockBgScroll) {
         //锁定or解锁页面滚动
-        lockMaskScroll[val ? "afterOpen" : "beforeClose"]();
+        lockMaskScroll[val ? 'afterOpen' : 'beforeClose']();
       }
     }
   }

+ 2 - 2
src/packages/dialog/doc.md

@@ -109,7 +109,7 @@ export default {
 | noFooter | 是否隐藏底部按钮栏 | Boolean | false
 | noOkBtn | 是否隐藏确定按钮 | Boolean | false
 | noCancelBtn | 是否隐藏取消按钮 | Boolean | false
-| cancelBtnTxt | 取消按钮文案 | String | ”取 s消“
+| cancelBtnTxt | 取消按钮文案 | String | ”取 消“
 | okBtnTxt | 确定按钮文案 | String | ”确 定“
 | okBtnDisabled | 禁用确定按钮 | Boolean | false
 | cancelAutoClose | 取消按钮是否默认关闭弹窗 | Boolean | true
@@ -124,4 +124,4 @@ export default {
 | link | 点击图片跳转的Url,仅对图片类型弹窗有效 | String | -
 | imgSrc | 图片Url,仅对图片类型弹窗有效 | String | -
 | animation | 是否开启默认动效 | Boolean | true
-| lockBgScroll | 锁定遮罩层滚动,不影响弹窗内部滚动(实验性质) | Boolean | false
+| lockBgScroll | 锁定遮罩层滚动,不影响弹窗内部滚动(实验性质)会给body添加posotion:fix属性,注意 | Boolean | false

+ 3 - 6
src/packages/textbox/doc.md

@@ -64,12 +64,9 @@ export default {
     };
   },
   methods: {
-    onFocus() {
-      console.log("focus事件触发!");
-    },
-    onBlur() {
-      console.log("blur事件触发!");
-    }
+     inputText(val){
+           alert(val);
+        }
   }
 };
 ```

+ 1 - 1
src/packages/toast/demo.vue

@@ -94,7 +94,7 @@
 
 <script>
 import locale from "../../mixins/locale";
-import { locale as i18n } from "../../locales";
+
 
 export default {
   mixins: [locale],