Browse Source

Merge branch 'v2' of https://github.com/jdf2e/nutui into v2

lilinsen 6 years ago
parent
commit
f74a33f5f5

+ 12 - 0
CHANGELOG.md

@@ -1,3 +1,15 @@
+## 2.1.3
+
+`2019-6-26`
+
+* :sparkles: feat: 新增头像组件`Avatar`
+* :sparkles: upd(SearchBar): 右侧文字或按钮增加事件,优化样式
+* :sparkles: upd(CountDown): 更新了单元测试用例
+* :sparkles: upd(NoticeBar): 优化了滚动速度
+* :sparkles: upd(date.js): 完善了`getNumTwoBit`方法( Thx to liu-dongyu)
+* :zap: chore: 更新部分依赖包版本
+* :zap: doc: 文档内容修改完善
+
 ## 2.1.2
 
 `2019-5-23`

+ 0 - 1
build/webpack.prod.conf.js

@@ -1,5 +1,4 @@
 const webpack = require('webpack');
-const config = require('../package.json');
 const path = require('path');
 const MiniCssExtractPlugin = require("mini-css-extract-plugin");
 const webpackBaseConf = require('./webpack.base.conf.js');

+ 1 - 0
build/webpack.prod.mini.conf.js

@@ -18,6 +18,7 @@ rimraf('./dist/nutui.min.css', function (err) {
 
 module.exports = merge(webpackBaseConf, {
     mode: 'production',
+    devtool: 'source-map',
     entry: {
         nutui: './src/nutui.js',
     },

+ 1 - 0
docs/intro.md

@@ -55,6 +55,7 @@ NutUI是一套京东风格的移动端Vue组件库,开发和服务于移动Web
 * [案例征集](https://github.com/jdf2e/nutui/issues/16)
 * [模板工程命令行工具(Gaea CLI)](https://www.npmjs.com/package/gaea-cli)
 * 联系我们:nutui@jd.com
+* [加入我们](/joinus)
 
 
 ## 开源协议

+ 24 - 0
docs/joinus.md

@@ -0,0 +1,24 @@
+## 招聘前端开发工程师
+
+岗位职责:
+* 负责京东PLUS会员、大客户、京东ME、人资行政类项目前端开发。
+* JS组件开发,包括 NutUI、 popui、 legao等通用类库、构建工具等开发。
+* 与设计师、后台工程师紧密工作,负责产出高质量的产品前端层。
+* 通过各种前端技术手段,提高用户体验并满足性能要求。
+* 充分理解项目需求和设计需求,具有一定钻研精神,能解决各种未知问题。有较强的沟通能力和抗压能力。
+
+
+岗位要求:
+* 计算机相关专业本科以上,4年以上前端开发经验,电商相关经验优先。
+* 精通各种Web前端技术,对符合Web标准的网站重构有丰富经验,有成功作品。
+* 掌握JS语言,ES6+,对JS框架( jQuery/Vue/ React)有实际项目经验。
+* 对CSS/JS性能优化、解决多浏览器兼容性问题有一定的经验。
+* 有基于Node的常见构建工具如Gulp、Rollup、 Webpack的实际项目经验。
+* 对用户体验、交互操作流程、及用户需求有一定了解。
+* 具备良好的服务意识、责任心及学习能力、优秀的团队沟通与协作能力。
+* 职级T5-T8,需要符合二五原则(各段平均工作年限需满2年)。
+
+
+职位诱惑:
+* 工作地点:北京亦庄京东集团总部。公司有免费班车,班车点基本覆盖全北京,距离不是距离
+* 公司福利:5层食堂、超大面积免费健身房(器械、跑步机、健身教练)、年假、带薪病假、大楼各种羊毛薅、各种内购内销、饮料零食…

+ 8 - 7
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@nutui/nutui",
-  "version": "2.1.2",
+  "version": "2.1.3",
   "description": "一套轻量级移动端Vue组件库",
   "typings": "dist/types/index.d.ts",
   "main": "dist/nutui.js",
@@ -51,7 +51,7 @@
     "intersection-observer": "^0.5.1"
   },
   "peerDependencies": {
-    "vue": "2.5.17"
+    "vue": "^2.6.10"
   },
   "devDependencies": {
     "@babel/cli": "7.1.2",
@@ -98,7 +98,7 @@
     "jest-serializer-vue": "2.0.2",
     "jsdom": "13.0.0",
     "jsdom-global": "3.0.2",
-    "marked": "0.5.1",
+    "marked": "^0.6.1",
     "mini-css-extract-plugin": "0.4.1",
     "mocha": "5.2.0",
     "mocha-webpack": "2.0.0-beta.0",
@@ -122,21 +122,22 @@
     "sass-loader": "7.1.0",
     "sass-resources-loader": "1.3.3",
     "semver": "5.5.1",
-    "shelljs": "0.8.2",
+    "shelljs": "^0.8.3",
     "style-loader": "0.22.1",
     "svg-sprite-loader": "3.9.2",
     "three": "^0.99.0",
     "uglifyjs-webpack-plugin": "1.3.0",
     "url-loader": "1.1.1",
-    "vue": "2.5.17",
+    "vue": "^2.6.10",
     "vue-i18n": "8.1.0",
     "vue-jest": "2.6.0",
     "vue-loader": "15.4.0",
     "vue-router": "^3.0.2",
-    "vue-style-loader": "4.1.2",
-    "vue-template-compiler": "2.5.17",
+    "vue-style-loader": "^4.1.2",
+    "vue-template-compiler": "^2.6.10",
     "vueg": "1.3.4",
     "webpack": "4.25.0",
+    "webpack-bundle-analyzer": "^3.3.2",
     "webpack-cli": "3.1.0",
     "webpack-dev-server": "3.1.11",
     "webpack-merge": "4.1.4",

+ 0 - 9
sites/demo/index.html

@@ -9,7 +9,6 @@
   <link rel="manifest" href="./demo/manifest.json">
   <title>NutUI - 移动端Vue组件库</title>
   <script src="https://h5.m.jd.com/babelDiy/Zeus/2846ykuM7PwipD9E2RzMj2BGEQpA/plugin/share.min.js"></script>
-  <!-- <script src="//misc.360buyimg.com/felibs/fastclick/1.0.6/fastclick.min.js"></script> -->
   <style>
     html {
         background: #F6F6F6;
@@ -22,12 +21,6 @@
 
 <body>
   <script>
-    // if ('addEventListener' in document) {
-    //   document.addEventListener('DOMContentLoaded', function () {
-    //     FastClick.attach(document.body);
-    //   }, false);
-    // }
-
     //分享配置
     var shareOption = {
       iconUrl: 'https://nutui.jd.com/img/logo_share.png',
@@ -50,8 +43,6 @@
       var jaq = jaq || [];
       jaq.push(['account', 'JA2018_1831300']);
       jaq.push(['domain', 'jd.com']);
-      jaq.push(['anchorpvflag', 'true']);
-      jaq.push(['anchorToUri', 1]);
       (function () {
         var ja = document.createElement('script');
         ja.type = 'text/javascript';

+ 13 - 11
sites/demo/view/index.vue

@@ -22,11 +22,12 @@
         </template>
       </ul>
     </div>
-    <div id="demo-footer" @click="showCode">京东用户体验设计部(JDC) · 前端开发部</div>
+    <div id="demo-footer">京东用户体验设计部(JDC) · 前端开发部 · v{{version}}</div>
   </div>
 </template>
 
 <script>
+import { version } from '../../../package.json';
 import { packages, sorts } from "../../../src/config.json";
 export default {
   name: "index",
@@ -34,6 +35,7 @@ export default {
     return {
       path: "",
       packages: {},
+      version,
       sortedPackages: [],
       oriSorts: [],
       sorts: [1, 2, 0, 3, 4, 5],
@@ -41,16 +43,16 @@ export default {
     };
   },
   methods: {
-    showCode(){
-        this.$dialog({
-          type:"image",
-          link:"",
-          imgSrc:"https://img14.360buyimg.com/imagetools/s350x350_jfs/t1/23439/7/11643/155926/5c90d554E7f03c831/bd45cd0ee2daa2fa.jpg.dpg",
-          onClickImageLink(){
-            return false;  //返回false可阻止默认的链接跳转行为
-          }
-        });
-    },
+    // showCode(){
+    //     this.$dialog({
+    //       type:"image",
+    //       link:"",
+    //       imgSrc:"https://img14.360buyimg.com/imagetools/s350x350_jfs/t1/23439/7/11643/155926/5c90d554E7f03c831/bd45cd0ee2daa2fa.jpg.dpg",
+    //       onClickImageLink(){
+    //         return false;  //返回false可阻止默认的链接跳转行为
+    //       }
+    //     });
+    // },
     toggleFold(idx) {
       this.foldStatus.splice(idx, 1, !this.foldStatus[idx]);
       sessionStorage.setItem("foldStatus", JSON.stringify(this.foldStatus));

+ 2 - 37
sites/doc/app.vue

@@ -64,17 +64,7 @@
       <div class="foot">
         Copyright © 2018~2019
         <a href="//jdc.jd.com" target="_blank">JDC</a>-
-        <a target="_blank" class="qrcode2" href="javascript:;">前端开发部
-            <a>
-                <img
-                  src="./asset/css/i/explor.png"
-                  alt
-                >
-               <svg class="strange" width="10" viewBox="0,0 6,5">
-                 <polygon points="0,0 3,5 6,0" fill="#fff"/>
-               </svg>
-              </a>
-        </a>
+        <a target="_blank" href="javascript:;">前端开发部</a>
       </div>
     </div>
   </div>
@@ -495,32 +485,7 @@ body {
 .docpad{
    padding: 8px 200px 8px 0;
 }
-.qrcode2{
-  position: relative;
-  &:hover{
-   a{
-      display: block;
-   }
-  }
-  a{
-    position: absolute;
-    line-height: 12px;
-    background: #fff;
-    color: #333;
-    bottom:25px;
-    left: -30px;
-    font-size: 14px;
-    display: none;
-  }
-  .strange{
-    position: absolute;
-    left: 63px;
-  }
-  img{
-     width: 140px;
-     
-  }
-}
+
 // .button-primary {
 //   display: block;
 //   margin: 50px 0;

+ 1 - 3
sites/doc/index.html

@@ -7,7 +7,7 @@
   <link rel="shortcut icon" href="/favicon.ico">
   <title>NutUI - 移动端Vue组件库</title>
   <meta name="description" content="移动端Vue组件库NutUI官网" />
-  <meta name="keywords" content="NutUI,NutUI 2.0,移动端Vue组件库,Vue components,JDC,京东用户体验设计部" />
+  <meta name="keywords" content="NutUI,NutUI 2.0,移动端Vue组件库,Vue移动端组件库,Vue组件库,Vue components,JDC,京东用户体验设计部" />
   <script src="//misc.360buyimg.com/felibs/vue/2.5.16/vue.min.js"></script>
   <style>
     a[title=站长统计]{
@@ -25,8 +25,6 @@
     var jaq = jaq || [];
     jaq.push(['account', 'JA2018_1831300']);
     jaq.push(['domain', 'jd.com']);
-    jaq.push(['anchorpvflag', 'true']);
-    jaq.push(['anchorToUri', 1]);
     (function () {
       var ja = document.createElement('script');
       ja.type = 'text/javascript';

+ 9 - 0
sites/doc/router.js

@@ -12,6 +12,7 @@ import frontCover from './index.vue';
  const Start = () => import('./page/start.vue');
  const International = () => import('./page/international.vue');
  const Theme = () => import('./page/theme.vue');
+ const JoinUs = () => import('./page/joinus.vue');
  //const Update = () => import('./page/changelog.vue');
 
 Vue.use(VueRouter);
@@ -62,6 +63,14 @@ const routes = [
       default: Index,
       main: Theme,     
     }
+  },
+  {
+    path: '/joinus',
+    name: 'joinus',
+    components: {
+      default: Index,
+      main: JoinUs,
+    }
   }
 ];
 //组件md文件展示

+ 10 - 0
src/config.json

@@ -452,6 +452,16 @@
       "sort": "1",
       "showDemo": true,
       "author": "Frans"
+    },
+    {
+      "version": "1.0.0",
+      "name": "Avatar",
+      "chnName": "头像",
+      "desc": "用来表示用户或事物,支持图片或字符展示。",
+      "type": "component",
+      "sort": "5",
+      "showDemo": true,
+      "author": "zhenyulei"
     }
   ]
 }

+ 4 - 1
src/nutui.js

@@ -87,6 +87,8 @@ import Uploader from "./packages/uploader/index.js";
 import "./packages/uploader/uploader.scss";
 import TextInput from "./packages/textinput/index.js";
 import "./packages/textinput/textinput.scss";
+import Avatar from "./packages/avatar/index.js";
+import "./packages/avatar/avatar.scss";
 
 const packages = {
   Cell,
@@ -131,7 +133,8 @@ const packages = {
   CountDown,
   InfiniteLoading,
   Uploader,
-  TextInput
+  TextInput,
+  Avatar
 };
 
 const components = {};

+ 62 - 0
src/packages/avatar/avatar.scss

@@ -0,0 +1,62 @@
+.nut-avatar{
+    background-size:100% 100%;
+    background-repeat: no-repeat;
+    background-position: center center;
+    display: inline-block;
+    position: relative;
+    margin-right: 10px;
+    .icon{
+        width:50%;
+        height: 50%;
+        background-size:100% 100%;
+        position: absolute;
+        top:50%;
+        left:50%;
+        transform: translate(-50%,-50%);
+    }
+    .text{
+        display: inline-block;
+        width:100%;
+        text-align: center;
+        overflow: hidden;
+    }
+    .dot{
+        position: absolute;
+        min-width: 18px;
+        min-height: 18px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        padding: 2px;
+        text-align: center;
+        border-radius: 50%;
+        background:red;
+        top:-4px;
+        right: -5px;
+        color: #fff;
+        font-size: 12px;
+        transform: scale(0.8);
+        line-height: 1;
+    }
+}
+.avatar-large{
+    width: 40px;
+    height: 40px;
+    line-height: 40px;
+}
+.avatar-small{
+    width: 24px;
+    height: 24px;
+    line-height: 24px;
+}
+.avatar-normal{
+    width:32px;
+    height: 32px;
+    line-height: 32px;
+}
+.avatar-round{
+    border-radius: 50%
+}
+.avatar-square{
+    border-radius: 5px;
+}

File diff suppressed because it is too large
+ 54 - 0
src/packages/avatar/avatar.vue


+ 64 - 0
src/packages/avatar/demo.vue

@@ -0,0 +1,64 @@
+<template>
+  <div class="demo-list">
+    <h4>默认用法</h4>
+    <p>内置"small","normal","large"三种尺寸规格</p>
+    <div class="white-bg">
+      <nut-avatar size="large"></nut-avatar>
+      <nut-avatar size="normal"></nut-avatar>
+      <nut-avatar size="small"></nut-avatar>
+    </div>
+    <h4>修改形状类型</h4>
+    <div class="white-bg">
+      <nut-avatar size="large" shape="square"></nut-avatar>
+      <nut-avatar size="normal" shape="square"></nut-avatar>
+      <nut-avatar size="small" shape="square"></nut-avatar>
+    </div>
+    <h4>修改背景色</h4>
+    <div class="white-bg">
+      <nut-avatar bgcolor="#f0250f"></nut-avatar>
+    </div>
+    <h4>可以修改头像的内容</h4>
+    <div class="white-bg">
+      <nut-avatar size="large" bgIcon>U</nut-avatar>
+    </div>
+    <h4>修改背景图片</h4>
+    <div class="white-bg">
+      <nut-avatar
+        bgIcon
+        bgImage="http://img30.360buyimg.com/uba/jfs/t1/84318/29/2102/10483/5d0704c1Eb767fa74/fc456b03fdd6cbab.png"
+      ></nut-avatar>
+    </div>
+    <h4>修改头像ICON图标</h4>
+    <div class="white-bg">
+      <nut-avatar
+        bgIcon="http://img10.360buyimg.com/uba/jfs/t1/69001/30/2126/550/5d06f947Effd02898/95f18e668670e598.png"
+      ></nut-avatar>
+    </div>
+    <h4>点击头像有触发事件</h4>
+    <div class="white-bg">
+      <nut-avatar @activeAvatar="activeAvatar"></nut-avatar>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  components: {},
+  data() {
+    return {};
+  },
+  methods: {
+    activeAvatar() {
+      alert("点击了头像");
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.white-bg {
+  padding: 10px;
+  background: #fff;
+  display: flex;
+  align-items: center;
+}
+</style>

+ 87 - 0
src/packages/avatar/doc.md

@@ -0,0 +1,87 @@
+# Avatar 头像
+
+用来代表用户或事物,支持图片、图标或字符展示。
+
+## 基本用法
+
+```html
+<nut-avatar></nut-avatar>
+```
+
+## 设置背景色
+
+```html
+<nut-avatar 
+    bgColor="#87d068"
+></nut-avatar>
+```
+
+
+## 设置大小
+
+内置 **smal** / **normal** / **large** 三种尺寸规格
+
+```html
+<nut-avatar size="large"></nut-avatar>
+<nut-avatar size="normal"></nut-avatar>
+<nut-avatar size="small"></nut-avatar>
+```
+
+## 设置头像的形状类型
+```html
+<nut-avatar 
+  shape="square"
+></nut-avatar>
+```
+
+
+## 设置头像的文本内容
+```html
+<nut-avatar 
+  :size="30"
+  bgIcon=""
+>U</nut-avatar>
+```
+
+## 设置头像背景图片
+```html
+<nut-avatar 
+  bgIcon="" 
+  bgImage="http://img30.360buyimg.com/uba/jfs/t1/84318/29/2102/10483/5d0704c1Eb767fa74/fc456b03fdd6cbab.png"
+>
+</nut-avatar>
+```
+
+## 设置头像Icon图标
+```html
+<nut-avatar
+  bgIcon="http://img10.360buyimg.com/uba/jfs/t1/69001/30/2126/550/5d06f947Effd02898/95f18e668670e598.png"
+>
+</nut-avatar>
+```
+
+## 点击头像有触发事件
+```html
+<nut-avatar 
+  @activeAvatar="activeAvatar"
+>
+</nut-avatar>
+```
+
+
+## Prop
+
+| 字段 | 说明 | 类型 | 默认值
+|----- | ----- | ----- | ----- 
+| bgColor | 设置头像背景色 | String | #eee
+| size | 设置头像的大小,提供三种:large /normal/small | String | normal
+| shape | 设置头像的形状,默认是圆形,可以设置为square方形 | String | --
+| bgImage | 设置头像的背景图片 | String | --
+| bgIcon | 设置头像的icon图标 | String | --
+
+
+## Event
+
+| 字段 | 说明 | 回调参数 
+|----- | ----- | ----- 
+| activeAvatar | 点击头像触发事件 | -- 

+ 8 - 0
src/packages/avatar/index.js

@@ -0,0 +1,8 @@
+import Avatar from './avatar.vue';
+import './avatar.scss';
+
+Avatar.install = function(Vue) {
+  Vue.component(Avatar.name, Avatar);
+};
+
+export default Avatar

+ 3 - 3
src/packages/countdown/__test__/countdown.spec.js

@@ -1,5 +1,5 @@
 import {shallowMount} from '@vue/test-utils';
-import CountDown, {restTime} from '../countdown.vue';
+import CountDown, {restTime, fill2} from '../countdown.vue';
 
 describe('CountDown.vue', () => {
     const end = 1559334689373;
@@ -10,9 +10,9 @@ describe('CountDown.vue', () => {
     });
     it('默认显示时分秒', () => {
         const rest = restTime(end - Date.now());
-        const h = Number(rest.d) * 24 + Number(rest.h);
+        const h = fill2(Number(rest.d) * 24 + Number(rest.h));
         const text_h = wrapper.findAll('.nut-cd-block').at(0).text();
-        expect(h).toBe(Number(text_h));
+        expect(h).toBe(text_h);
         expect(h).toBe(wrapper.vm.resttime.h);
     });
 

+ 4 - 3
src/packages/countdown/countdown.vue

@@ -4,7 +4,7 @@
       <span class="nut-cd-block">{{plainText}}</span>
     </template>
     <template v-else>
-      <template v-if="resttime.d > 0 && showDays">
+      <template v-if="resttime.d >= 0 && showDays">
         <span class="nut-cd-block">{{resttime.d}}</span>
         <span class="nut-cd-dot">天</span>
       </template>
@@ -99,7 +99,7 @@ const countdownTimer = {
       const rest = restTime(this.restTime);
       const {d, h, m, s} = rest;
       if(!this.showDays && d > 0) {
-        rest.h = Number(rest.h) + d * 24;
+        rest.h = fill2(Number(rest.h) + d * 24);
         rest.d = 0;
       }
       return rest;
@@ -154,7 +154,8 @@ const countdownTimer = {
 }
 countdownTimer.restTime = restTime;
 
-export {restTime};
+// export fill2 for test
+export {restTime, fill2};
 export default countdownTimer; 
 </script>
 

+ 0 - 114
src/packages/datepicker/utils.js

@@ -1,114 +0,0 @@
-let Utils = {
-	/**
-	 * 是否为闫年
-	 * @return {Boolse} true|false
-	 */
-	isLeapYear: function(y) {
-	    return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
-	},
-
-	/**
-	 * 返回星期数
-	 * @return {Number}
-	 */
-	getWhatDay: function(year, month, day) {
-	    let date = new Date(year + '/' + month + '/' + day);
-		let index = date.getDay();
-		let dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
-	    return dayNames[index];
-	},
-
-	/**
-     * 返回星期数
-     * @return {Number}
-     */
-    getMonthPreDay: function(year, month) {
-        var date = new Date(year + '/' + month + '/01');
-        var day = date.getDay();
-        if (day == 0) {
-            day = 7;
-        }
-        return day;
-    },
-
-	/**
-	 * 返回月份天数
-	 * @return {Number}
-	 */
-	getMonthDays: function(year, month) {
-	    if (/^0/.test(month)) {
-	        month = month.split('')[1];
-	    }
-	    return [0, 31, (this.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
-	},
-
-	/**
-	 * 补齐数字位数
-	 * @return {string}
-	 */
-	getNumTwoBit: function(n) {
-	    return (n > 9 ? '' : '0') + n;
-	},
-
-	/**
-	 * 日期对象转成字符串
-	 * @return {string}
-	 */
-	date2Str: function(date, split) {
-	    if (typeof date == 'string') return date;
-	    split = split || '-';
-	    let y = date.getFullYear();
-	    let m = this.getNumTwoBit(date.getMonth() + 1);
-	    let d = this.getNumTwoBit(date.getDate());
-	    return [y, m, d].join(split);
-	},
-
-	/**
-	 * 返回日期格式字符串
-	 * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
-	 * @return {string} '2014-12-31'
-	 */
-	getDay: function (i) {
-	    i = i || 0;
-	    let date = new Date();
-	    let diff = i * (1000 * 60 * 60 * 24);
-	    date = new Date(date.getTime() + diff);
-	    return this.date2Str(date);
-	},
-
-	/**
-	 * 时间戳转换为日期格式
-	 * @return {String}
-	 */
-	timestampToDate: function (timestamp) {
-	    let date = new Date(timestamp);
-	    return date.getFullYear() + '-' + getNumTwoBit((date.getMonth() + 1)) + '-' + getNumTwoBit(date.getDate());
-	},
-
-	/**
-     * 时间比较
-     * @return {Boolean}
-     */
-    compareDate: function (date1, date2) {
-        let startTime = new Date(date1.replace('-', '/').replace('-', '/'));
-        let endTime = new Date(date2.replace('-', '/').replace('-', '/'));
-        if (startTime >= endTime) {
-            return false;
-        }
-        return true;
-	},
-	/**
-     * 时间是否相等
-     * @return {Boolean}
-     */
-    isEqual: function (date1, date2) {
-        let startTime = new Date(date1).getTime();
-        let endTime = new Date(date2).getTime();
-        if (startTime == endTime) {
-            return true;
-        }
-        return false;
-	}
-};
-
-export default Utils;

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

@@ -71,7 +71,7 @@
       </nut-cell>
     </div>
     <!-- 以标签形式调用Dialog -->
-    <nut-dialog title="标签形式调用" :visible="dialogShow" @close="dialogShow=false">
+    <nut-dialog title="标签形式调用" :visible="dialogShow" @ok-btn-click="dialogShow=false" @cancel-btn-click="dialogShow=false" @close="dialogShow=false">
       <a href="javascript:;" @click="dialogShow=false" :noCancelBtn="true">点我可以直接关闭对话框</a>
     </nut-dialog>
   </div>

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

@@ -82,7 +82,7 @@ this.$dialog({
 如果Dialog内容有复杂交互,可使用Dialog的标签式用法。
 
 ```html
-<nut-dialog title="标签形式调用" :visible="dialogShow" @close="dialogShow=false">
+<nut-dialog title="标签形式调用" :visible="dialogShow" @ok-btn-click="dialogShow=false" @cancel-btn-click="dialogShow=false" @close="dialogShow=false">
     <a href="javascript:;" @click="dialogShow=false" :noCancelBtn="true">点我可以直接关闭对话框</a>
 </nut-dialog>
 ```

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

@@ -17,7 +17,7 @@
     </nut-noticebar>
     <h4>通告栏模式--链接模式</h4>
     <nut-noticebar
-      left-icon="//img.yzcdn.cn/vant/volume.png"
+      left-icon="https://img13.360buyimg.com/imagetools/jfs/t1/72082/2/3006/1197/5d130c8dE1c71bcd6/e48a3b60804c9775.png"
     >
       <a href="https://www.jd.com">京东商城</a>
     </nut-noticebar>

+ 14 - 14
src/packages/noticebar/doc.md

@@ -26,7 +26,7 @@
 ## 通告栏模式--链接模式
 ```html
     <nut-noticebar
-      left-icon="//img.yzcdn.cn/vant/volume.png"
+      left-icon="https://img13.360buyimg.com/imagetools/jfs/t1/72082/2/3006/1197/5d130c8dE1c71bcd6/e48a3b60804c9775.png"
     >
       <a href="https://www.jd.com">京东商城</a>
     </nut-noticebar>
@@ -36,19 +36,19 @@
 
 ## Prop
 
-| 字段 | 说明 | 类型 | 默认值
-|----- | ----- | ----- | ----- 
-| text | 提示的信息 | String | 空
-| closeMode | 是否启用关闭模式 | Boolean | false
-| leftIcon | close为没有左边icon,其他为自定义的图片链接,没有为默认图片 | String | 空
-| color | 是否禁用 | String | 空
-| background | 是否禁用 | String | 空
-| delay | 是否禁用 | String/Number | 1
-| scrollable | 是否禁用 | Boolean | true
-| speed | 是否禁用 | Number | 50
+| 字段       | 说明                                                       | 类型          | 默认值 |
+| ---------- | ---------------------------------------------------------- | ------------- | ------ |
+| text       | 提示的信息                                                 | String        | 空     |
+| closeMode  | 是否启用关闭模式                                           | Boolean       | false  |
+| leftIcon   | close为没有左边icon,其他为自定义的图片链接,没有为默认图片 | String        | 空     |
+| color      | 导航栏的文字颜色                                           | String        | 空     |
+| background | 导航栏的背景颜色                                           | String        | 空     |
+| delay      | 延时多少秒                                                 | String/Number | 1      |
+| scrollable | 是否可以滚动                                               | Boolean       | true   |
+| speed      | 移动375px需要用的时间                                      | Number        | 6      |
 
 ## Event
 
-| 字段 | 说明 | 回调参数
-|----- | ----- | -----
-| click | 外层点击事件回调 | 无 
+| 字段  | 说明             | 回调参数 |
+| ----- | ---------------- | -------- |
+| click | 外层点击事件回调 | 无       |

File diff suppressed because it is too large
+ 82 - 66
src/packages/noticebar/noticebar.scss


File diff suppressed because it is too large
+ 142 - 125
src/packages/noticebar/noticebar.vue


+ 3 - 1
src/packages/searchbar/doc.md

@@ -1,5 +1,7 @@
 # SearchBar 搜索栏
 
+> 依赖 **Icon** 组件
+
 ## 基本用法
 
 ```html
@@ -87,4 +89,4 @@ export default {
 | focus | 输入框获取焦点时触发事件 | 无
 | input | 输入框输入内容时触发事件 | 无
 | blur | 输入框失去焦点时触发事件 | 无
-| submit | 默认提交事件 | 无
+| submit | 默认提交事件,点击右侧Icon或文字也会触发 | 无

+ 4 - 4
src/packages/searchbar/searchbar.scss

@@ -13,7 +13,7 @@
 	    	margin-right: 10px;
 	    	.nut-icon {
 	    		float: left;
-	    		margin: 10px 0 0 10px;
+	    		margin: 8px 0 0 10px;
 	    	}
 	    	.close-icon {
 	    		display: none;
@@ -47,9 +47,9 @@
         }
 	}
 	.btn-search {
-		display: inline-block;
-		line-height: 2;
-		text-align: center;
+		display: inline-flex;
+		align-items: center;
+		justify-content: center;
 		color: $title-color;
 	}
 	a {

+ 6 - 6
src/packages/searchbar/searchbar.vue

@@ -16,7 +16,7 @@
 	    		</span>
 	    	</form>
     	</div>
-    	<a href="javascript:;" class="btn-search" v-if="hasSearchButton">
+    	<a href="javascript:;" class="btn-search" v-if="hasSearchButton" @click="submitFun">
     		<span v-if="hasTextButton">{{textInfo || nutTranslate('lang.searchbar.textInfo')}}</span>
     		<nut-icon type="search" v-else width="20" height="20"></nut-icon>
     	</a>
@@ -72,23 +72,23 @@ export default {
     },
     methods: {
     	//清空 input 输入
-    	clearInput: function() {
+    	clearInput() {
     		this.value = '';
     		this.hasCloseIcon = false;
     	},
-    	focusFun: function() {
+    	focusFun() {
     		this.inputFocusAnimation = true;
     		this.$emit('focus');
     	},
-    	inputFun: function() {
+    	inputFun() {
     		this.hasCloseIcon = this.value ? true:false;
     		this.$emit('input', this.value);
     	},
-    	blurFun: function() {
+    	blurFun() {
     		this.inputFocusAnimation = false;
     		this.$emit('blur', this.value);
     	},
-        submitFun: function() {
+        submitFun() {
             this.$emit('submit', this.value);
         }
     }

+ 4 - 3
src/utils/date.js

@@ -23,8 +23,8 @@ let Utils = {
      * @return {Number}
      */
     getMonthPreDay: function(year, month) {
-        var date = new Date(year + '/' + month + '/01');
-        var day = date.getDay();
+        let date = new Date(year + '/' + month + '/01');
+        let day = date.getDay();
         if (day == 0) {
             day = 7;
         }
@@ -47,7 +47,8 @@ let Utils = {
 	 * @return {string}
 	 */
 	getNumTwoBit: function(n) {
-	    return (n > 9 ? '' : '0') + n;
+		n = Number(n);
+		return (n > 9 ? '' : '0') + n;
 	},
 
 	/**

+ 10 - 8
src/utils/raf.js

@@ -1,12 +1,14 @@
 function requestAniFrame() {
-    return (
-        window.requestAnimationFrame ||
-        window.webkitRequestAnimationFrame ||
-        window.mozRequestAnimationFrame ||
-        function (callback) {
-            window.setTimeout(callback, 1000 / 60);
-        }
-    );
+    if(typeof window !== 'undefined'){
+        return (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || 
+            function (callback) {
+                window.setTimeout(callback, 1000 / 60);
+            });
+    }else{
+        return function (callback) {
+                    setTimeout(callback, 1000 / 60);
+               };
+    }
 }
 
 export default requestAniFrame();

+ 1 - 0
types/nutui.d.ts

@@ -60,3 +60,4 @@ export declare class Scroller extends UIComponent {}
 export declare class CountDown extends UIComponent {}
 export declare class Uploader extends UIComponent {}
 export declare class TextInput extends UIComponent {}
+export declare class Avatar extends UIComponent {}