Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed Nov 13, 2019
2 parents c6d39fe + f5ccbc9 commit 04677dc
Show file tree
Hide file tree
Showing 27 changed files with 703 additions and 74 deletions.
34 changes: 34 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: '缺陷问题反馈'
about: '如何正确的提出一个 Issue'
title: ''
labels: ''
assignees: ''

---

<!--
感谢您向我们反馈问题,为了高效的解决问题,我们期望你能提供以下信息:
-->

## What happens?
<!-- 清晰的描述下遇到的问题。-->

## 最小可复现仓库
> 请创建最小可复现代码,并上传到你的 GitHub 仓库
<!-- https://github.com/YOUR_REPOSITORY_URL -->
## 预期的行为和实际行为


## 复现步骤,具体代码


<!-- 请提供复现步骤,错误日志以及相关配置 -->
<!-- 可以尝试不要锁版本,重新安装依赖试试先 -->


## 相关环境信息
- **操作系统**
- **Node 版本**
- **NutUI 版本**
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.1.7

`2019-11-13`
* :sparkles: upd(swiper): 异步加载不需主动调用updateEvent事件、懒加载方式优化
* :sparkles: upd(uploader): 增加自定义header功能
* :sparkles: feat: 新增图片懒加载组件`LazyLoad`
* :zap: chore(webpack): 构建环境多入口模式(构建环境支持 doc文档和mobile 示例 同时调试);热更新配置,公共模块
* :zap: doc: start.md 文档修改
* :bug: fix: datepicker 组件bug修复(异步修改startDate,endDate,defaultValue字段无响应;时间限制支持到时、分)

## 2.1.6

`2019-10-15`
Expand Down
12 changes: 7 additions & 5 deletions build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = {
plugins: [
new webpack.BannerPlugin({
banner: `NutUI v${config.version} - [filebase], [hash], ${moment().format()}
(c) 2017-2018 JDC
(c) 2017-2019 JDC
Released under the MIT License.`
}),
new HappyPack({
Expand All @@ -105,10 +105,12 @@ Released under the MIT License.`
format: ' build [:bar] ' + chalk.green.bold(':percent') + ' (:elapsed seconds)',
clear: false,
width: 100
}),
new WebpackBuildNotifierPlugin({
title: "My Project Webpack Build",
}),
new WebpackBuildNotifierPlugin({
title: "NutUI Webpack Build",
suppressSuccess: true
})
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
],
}
116 changes: 116 additions & 0 deletions build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
const config = require('../package.json');
const path = require('path');
const webpackBaseConf = require('./webpack.base.conf.js');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const merge = require('webpack-merge');
const mdtohtml = require('../scripts/mdToVue');
const isDev = process.env.NODE_ENV === 'development';


module.exports = merge(webpackBaseConf, {
mode: 'development',
entry: {
'nutui-mobile': './sites/demo/app.js',
'nutui-doc': './sites/doc/app.js',
},
output: {
publicPath: '/',
filename: '[name].js',
},
module: {
rules: [
//自定义主题
// {
// test: /\.(sa|sc|c)ss$/,
// use: [
// {
// loader: 'sass-loader',
// options: {
// data: `@import "./sites/demo/asset/css/custom.scss";@import "./src/styles/index.scss"; `,
// },
// }
// ],
// }
]
},
optimization: {
splitChunks: {
cacheGroups: {
chunks: {
chunks: 'all',
minChunks: 2,
minSize: 0,
name: 'chunks'
}
}
}
},
plugins: [
//demo
new HtmlWebpackPlugin({
template: './sites/demo/index.html',
filename: 'demo.html',
hash: true,//防止缓存
inject: true,
chunks: ['chunks', 'nutui-mobile'],
minify: {
multihtmlCache: true,// 解决多页打包的关键!
minifyJS: true,
minifyCSS: true,
removeAttributeQuotes: true//压缩 去掉引号
}
}),
// doc
new mdtohtml({
entry: './src',
output: './sites/doc/view/',
template: './doc-site/template.html',
nav: 'left',
needCode: true,
isbuild: isDev,
hasMarkList: false
}),
new mdtohtml({
entry: './docs',
output: './sites/doc/page/',
template: './doc-site/template.html',
nav: 'left',
needCode: false,
isbuild: isDev
}),
new HtmlWebpackPlugin({
template: './sites/doc/index.html',
filename: 'default.html',
hash: true,//防止缓存
inject: true,
chunks: ['chunks', 'nutui-doc'],
minify: {
multihtmlCache: true,// 解决多页打包的关键!
minifyJS: true,
minifyCSS: true,
removeAttributeQuotes: true//压缩 去掉引号
}
}),
],
devtool: 'cheap-module-eval-source-map',
devServer: {
contentBase: path.resolve(__dirname, 'dist/sites'),
compress: true,
index: 'default.html',
historyApiFallback: true,
disableHostCheck: true,
host: "0.0.0.0",
hot: true,
hotOnly: true,
inline: true,
overlay: {
warnings: true,
errors: true
},
watchOptions: {
ignored: /node_modules/
}
}

});
11 changes: 11 additions & 0 deletions docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ yarn add @nutui/nutui

当然你也可以通过 CDN 的方式引入, 可以在 **jsdelivr****unpkg** 等公共 CDN 上获取到 NutUI。我们推荐链接到一个你可以手动更新的指定版本号。

```html 开发环境版本,包含了有帮助的命令行警告
<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<!-- 引入样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@nutui/nutui@latest/dist/nutui.css">
<!-- 引入Vue -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://cdn.jsdelivr.net/npm/@nutui/nutui@latest/dist/nutui.js"></script>
```
或者
```html
<!-- 生产环境版本,优化了尺寸和速度 -->
<!-- 引入样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@nutui/nutui@latest/dist/nutui.min.css">
<!-- 引入Vue -->
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui",
"version": "2.1.6",
"version": "2.1.7",
"description": "一套轻量级移动端Vue组件库",
"typings": "dist/types/index.d.ts",
"main": "dist/nutui.js",
Expand All @@ -12,7 +12,8 @@
"CHANGELOG.md"
],
"scripts": {
"dev": "npm run dev:demo",
"dev": "npm run dev:new",
"dev:new": "cross-env NODE_ENV=development DOC_TYPE=true webpack-dev-server -d --open --config build/webpack.dev.conf.js",
"dev:carefree": "cross-env NODE_ENV=carefree carefree_env=dev webpack -w --colors --progress --config build/webpack.demo.dev.conf.js",
"dev:demo": "cross-env NODE_ENV=development webpack-dev-server -d --open --config build/webpack.demo.dev.conf.js",
"dev:doc": "cross-env NODE_ENV=development DOC_TYPE=true webpack-dev-server -d --open -w --progress --config build/webpack.doc.dev.conf.js",
Expand Down Expand Up @@ -136,6 +137,7 @@
"vue": "^2.6.10",
"vue-i18n": "8.1.0",
"vue-jest": "2.6.0",
"vue-lazyload": "1.3.3",
"vue-loader": "15.4.0",
"vue-router": "^3.0.2",
"vue-style-loader": "^4.1.2",
Expand All @@ -160,4 +162,4 @@
"instrument": false,
"sourceMap": false
}
}
}
7 changes: 4 additions & 3 deletions sites/doc/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
<div class="bg">
<img src="./asset/css/i/phtitle.png" alt>
<div>
<input type="text" readonly :value="'https://nutui.jd.com/demo.html#/'+routerName">
<input type="text" readonly :value="demourl+routerName">
</div>
</div>
<iframe :src="'//nutui.jd.com/demo.html#/'+routerName+'?ver='+version"></iframe>
<iframe :src="demourl+routerName+'?ver='+version"></iframe>
</div>
</div>
</div>
Expand Down Expand Up @@ -92,7 +92,8 @@ export default {
showPhone: false,
searchCurName: "",
searchIndex: 0,
codeurl: ""
codeurl: "",
demourl: location.origin + '/demo.html#/'
};
},
watch: {
Expand Down
1 change: 1 addition & 0 deletions sites/doc/asset/css/style-blue.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
blockquote {
padding: 0;
margin: 0;
margin-top: 10px;
p {
margin: 0;
display: inline-block;
Expand Down
10 changes: 10 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,16 @@
"sort": "5",
"showDemo": true,
"author": "zhenyulei"
},
{
"version": "1.0.0",
"name": "lazyload",
"chnName": "图片懒加载",
"desc": "图片懒加载",
"type": "component",
"sort": "0",
"showDemo": true,
"author": "zhuzhida"
}
]
}
9 changes: 8 additions & 1 deletion src/nutui.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ import TextInput from "./packages/textinput/index.js";
import "./packages/textinput/textinput.scss";
import Avatar from "./packages/avatar/index.js";
import "./packages/avatar/avatar.scss";
import Lazyload from "./packages/lazyload/index.js";


const packages = {
Cell,
Expand Down Expand Up @@ -144,7 +146,6 @@ const directives = {};
pkgList.map(item => {
const pkg = packages[item.name];
if (!pkg) return;

if (item.type == 'component') {
if (pkg.name) {
components[pkg.name] = pkg;
Expand Down Expand Up @@ -197,6 +198,11 @@ const install = function (Vue, opts = {}) {
Vue.directive(directives[cptName].name, directives[cptName]);
}
}

Vue.use(Lazyload, {
lazyComponent: true,
loading: '//img12.360buyimg.com/imagetools/jfs/t1/73967/28/14561/916/5dc142e4E0666555b/bf33454553c6035e.png'
});
};

if (typeof window !== 'undefined' && window.Vue) {
Expand All @@ -207,6 +213,7 @@ export default {
version,
locale,
install,
Lazyload,
...components,
...filters,
...directives,
Expand Down
Loading

0 comments on commit 04677dc

Please sign in to comment.