Merge branch 'master' of gitlab.qima-inc.com:fe/zanui-vue

This commit is contained in:
pangxie1991 2017-03-24 10:43:58 +08:00
commit 12949dd6ea
9 changed files with 7108 additions and 189 deletions

View File

@ -1,17 +1,11 @@
/**
* Created by tsxuehu on 17/1/4.
*/
var config = {
"bem": {
"shortcuts": {"component": "b", "modifier": "m", "descendent": "e"},
"separators": {"descendent": "__", "modifier": "--"}
}/*,
"autoprefixer": {"browsers": ["ie > 8", "last 2 versions"]},
"rem": {"browsers": ["ie > 8", "last 2 versions"]}*/
'bem': {
'shortcuts': {'component': 'b', 'modifier': 'm', 'descendent': 'e'},
'separators': {'descendent': '__', 'modifier': '--'}
}
};
// https://github.com/trysound/postcss-easy-import
var partialImport = require("postcss-easy-import");
var partialImport = require("postcss-easy-import")();
// 这不是bem虽然名字叫bem其实它是suit
// https://github.com/saladcss/saladcss-bem
@ -20,47 +14,15 @@ var bem = require("saladcss-bem")(config.bem);
// https://github.com/jonathantneal/precss
var precss = require("precss")();
// https://github.com/adam-h/postcss-sass-color-functions
var sassColor = require("postcss-sass-color-functions")();
// eleme的组件---
// https://npmjs.com/package/postcss-css-reset
// http://elemefe.github.io/postcss-salad/
var reset = require("postcss-css-reset")();
// eleme的组件---
// https://npmjs.com/package/postcss-utils
// http://elemefe.github.io/postcss-salad/
var utils = require("postcss-utils")();
// https://github.com/postcss/postcss-calc
var calc = require("postcss-calc")();
// https://github.com/maximkoretskiy/postcss-initial
var initial = require("postcss-initial")();
// https://github.com/trysound/postcss-inline-svg
var inlineSvg = require("postcss-inline-svg")();
// https://github.com/jonathantneal/postcss-short
var short = require("postcss-short")();
// eleme的组件---
// https://github.com/baiyaaaaa/postcss-shape
// http://elemefe.github.io/postcss-salad/
var shape = require("postcss-shape")();
// https://github.com/robwierzbowski/node-pixrem
var rem = require("pixrem")();
// https://github.com/postcss/autoprefixer
var autoprefixer = require("autoprefixer")();
// https://github.com/jo-asakura/postcss-neat
var neat = require("postcss-neat")();
module.exports = function (webpack) {
// 顺序很重要
return [partialImport({ addDependencyTo: webpack }), bem, precss, sassColor, reset,
utils, calc, initial, inlineSvg, short, shape, rem, autoprefixer, neat];
return [
partialImport,
bem,
precss,
autoprefixer
];
};

View File

@ -6,6 +6,7 @@ var striptags = require('./strip-tags');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var version = require('../package.json').version;
var getPoastcssPlugin = require('./utils/postcss_pipe');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
function convert(str) {
str = str.replace(/(&#x)(\w{4});/gi, function($0) {
@ -72,12 +73,65 @@ module.exports = {
}
]
},
devtool: 'source-map'
devtool: 'source-map',
plugins: [
new ProgressBarPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
]
};
if (process.env.NODE_ENV === 'production') {
delete module.exports.devtool;
module.exports.plugins = [
module.exports.plugins = module.exports.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
@ -92,114 +146,5 @@ if (process.env.NODE_ENV === 'production') {
},
sourceMap: false
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
];
} else {
module.exports.plugins = [
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
];
};
]);
}

2
docs/dist/0.js vendored

File diff suppressed because one or more lines are too long

2
docs/dist/1.js vendored
View File

@ -1 +1 @@
webpackJsonp([1],{270:function(e,t,n){n(509);var i=n(0)(n(286),n(448),null,null);e.exports=i.exports},286:function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(30),a=i(o),s=n(387),r=i(s);t.default={data:function(){return{highlights:[],navState:[],data:a.default["zh-CN"],base:"/component"}},components:{MobileNav:r.default}}},288:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{group:{type:Object,default:function(){return[]}},base:String},data:function(){return{isOpen:!1}}}},340:function(e,t,n){t=e.exports=n(11)(),t.push([e.i,".side-nav{width:100%;box-sizing:border-box;padding:90px 15px 20px;position:relative;z-index:1}.side-nav .zanui-desc,.side-nav .zanui-title{text-align:center;font-weight:400}.side-nav .zanui-title{font-size:26px;color:#333}.side-nav .zanui-desc{font-size:14px;color:#666;margin-bottom:50px}",""])},356:function(e,t,n){t=e.exports=n(11)(),t.push([e.i,".mobile-nav-group{border-radius:2px;margin-bottom:15px;padding-left:20px;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.mobile-nav-group li{list-style:none}.mobile-nav-group ul{padding:0;margin:0;overflow:hidden}.mobile-nav-group__title{font-size:16px;color:#333;line-height:56px;position:relative}.mobile-nav-group__title a{color:#333;display:block;border-top:1px solid #e5e5e5}.mobile-nav-group__title .zan-icon-arrow{position:absolute;font-size:12px;line-height:1;top:24px;right:20px}.mobile-nav-group__title--open{color:#999}",""])},387:function(e,t,n){n(525);var i=n(0)(n(288),n(469),null,null);e.exports=i.exports},448:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"side-nav"},[n("h1",{staticClass:"zanui-title"},[e._v("Zan UI Wap")]),e._v(" "),n("h2",{staticClass:"zanui-desc"},[e._v("有赞移动wap端组件库")]),e._v(" "),n("div",{staticClass:"mobile-navs"},[e._l(e.data,function(t){return[t.showInMobile?n("div",{staticClass:"mobile-nav-item"},e._l(t.groups,function(t){return n("mobile-nav",{attrs:{group:t,base:e.base}})})):e._e()]})],2)])},staticRenderFns:[]}},469:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"mobile-nav-group"},[n("div",{staticClass:"mobile-nav-group__title",class:{"mobile-nav-group__title--open":e.isOpen},on:{click:function(t){e.isOpen=!e.isOpen}}},[e._v("\n "+e._s(e.group.groupName)+"\n ")]),e._v(" "),n("ul",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"pure-menu-list"},[e._l(e.group.list,function(t){return[t.disabled?e._e():n("li",{staticClass:"mobile-nav-group__title"},[n("router-link",{attrs:{"active-class":"active",to:e.base+t.path},domProps:{textContent:e._s(t.title)}}),e._v(" "),n("zan-icon",{attrs:{name:"arrow"}})],1)]})],2)])},staticRenderFns:[]}},509:function(e,t,n){var i=n(340);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(31)("1517d9c0",i,!0)},525:function(e,t,n){var i=n(356);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(31)("8bcdd7d6",i,!0)}});
webpackJsonp([1],{270:function(e,t,n){n(510);var i=n(0)(n(286),n(449),null,null);e.exports=i.exports},286:function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(30),a=i(o),s=n(388),r=i(s);t.default={data:function(){return{highlights:[],navState:[],data:a.default["zh-CN"],base:"/component"}},components:{MobileNav:r.default}}},288:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{group:{type:Object,default:function(){return[]}},base:String},data:function(){return{isOpen:!1}}}},341:function(e,t,n){t=e.exports=n(11)(),t.push([e.i,".side-nav{width:100%;box-sizing:border-box;padding:90px 15px 20px;position:relative;z-index:1}.side-nav .zanui-desc,.side-nav .zanui-title{text-align:center;font-weight:400}.side-nav .zanui-title{font-size:26px;color:#333}.side-nav .zanui-desc{font-size:14px;color:#666;margin-bottom:50px}",""])},357:function(e,t,n){t=e.exports=n(11)(),t.push([e.i,".mobile-nav-group{border-radius:2px;margin-bottom:15px;padding-left:20px;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.mobile-nav-group li{list-style:none}.mobile-nav-group ul{padding:0;margin:0;overflow:hidden}.mobile-nav-group__title{font-size:16px;color:#333;line-height:56px;position:relative}.mobile-nav-group__title a{color:#333;display:block;border-top:1px solid #e5e5e5}.mobile-nav-group__title .zan-icon-arrow{position:absolute;font-size:12px;line-height:1;top:24px;right:20px}.mobile-nav-group__title--open{color:#999}",""])},388:function(e,t,n){n(526);var i=n(0)(n(288),n(470),null,null);e.exports=i.exports},449:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"side-nav"},[n("h1",{staticClass:"zanui-title"},[e._v("Zan UI Wap")]),e._v(" "),n("h2",{staticClass:"zanui-desc"},[e._v("有赞移动wap端组件库")]),e._v(" "),n("div",{staticClass:"mobile-navs"},[e._l(e.data,function(t){return[t.showInMobile?n("div",{staticClass:"mobile-nav-item"},e._l(t.groups,function(t){return n("mobile-nav",{attrs:{group:t,base:e.base}})})):e._e()]})],2)])},staticRenderFns:[]}},470:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"mobile-nav-group"},[n("div",{staticClass:"mobile-nav-group__title",class:{"mobile-nav-group__title--open":e.isOpen},on:{click:function(t){e.isOpen=!e.isOpen}}},[e._v("\n "+e._s(e.group.groupName)+"\n ")]),e._v(" "),n("ul",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"pure-menu-list"},[e._l(e.group.list,function(t){return[t.disabled?e._e():n("li",{staticClass:"mobile-nav-group__title"},[n("router-link",{attrs:{"active-class":"active",to:e.base+t.path},domProps:{textContent:e._s(t.title)}}),e._v(" "),n("zan-icon",{attrs:{name:"arrow"}})],1)]})],2)])},staticRenderFns:[]}},510:function(e,t,n){var i=n(341);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(31)("1517d9c0",i,!0)},526:function(e,t,n){var i=n(357);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(31)("8bcdd7d6",i,!0)}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,25 @@
<template><section class="demo-badge"><h1 class="demo-title">badge</h1><example-block title="基础用法">
<zan-badge-group active-key="2">
<zan-badge mark="0" title="热销榜" info="8" url="http://baidu.com"></zan-badge>
<zan-badge mark="1" title="花式寿司" info="99"></zan-badge>
<zan-badge mark="2" title="火炽寿司"></zan-badge>
<zan-badge mark="3" title="手握寿司" info="199"></zan-badge>
<zan-badge-group :active-key="activeKey">
<zan-badge mark="0" title="热销榜" info="8" url="http://baidu.com" @click="onItemClick"></zan-badge>
<zan-badge mark="1" title="花式寿司" info="99" @click="onItemClick"></zan-badge>
<zan-badge mark="2" title="火炽寿司" @click="onItemClick"></zan-badge>
<zan-badge mark="3" title="手握寿司" info="199" @click="onItemClick"></zan-badge>
</zan-badge-group>
</example-block></section></template>
<script>
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);</script>
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);
export default {
data() {
return {
activeKey: '2'
};
},
methods: {
onItemClick(e, data) {
this.activeKey = data.mark;
}
}
};
</script>

View File

@ -10,7 +10,7 @@
"packages"
],
"scripts": {
"bootstrap": "npm i --registry=http://registry.npm.qima-inc.com",
"bootstrap": "yarn || npm i --registry=http://registry.npm.qima-inc.com",
"dev": "npm run build:file && webpack-dev-server --inline --history-api-fallback --hot --config build/webpack.config.js",
"build:file": "node build/bin/build-entry.js",
"build:utils": "cross-env BABEL_ENV=utils babel src --out-dir lib --ignore src/index.js",
@ -77,10 +77,7 @@
"extract-text-webpack-plugin": "^2.0.0-beta.5",
"file-loader": "^0.9.0",
"file-save": "^0.2.0",
"gh-pages": "^0.11.0",
"gulp": "^3.9.1",
"gulp-cssmin": "^0.1.7",
"gulp-postcss": "^6.1.1",
"gulp-util": "^3.0.8",
"highlight.js": "^9.8.0",
"html-loader": "^0.4.3",
@ -103,21 +100,9 @@
"markdown-it-anchor": "^2.5.0",
"markdown-it-container": "^2.0.0",
"mocha": "^3.2.0",
"pixrem": "^3.0.0",
"postcss": "^5.1.2",
"postcss-calc": "^5.0.0",
"postcss-css-reset": "^1.0.2",
"postcss-easy-import": "^2.0.0",
"postcss-initial": "^1.3.1",
"postcss-inline-svg": "^1.4.0",
"postcss-loader": "^0.13.0",
"postcss-neat": "^2.5.2",
"postcss-pseudo-class-any-link": "^1.0.0",
"postcss-sass-color-functions": "^1.1.0",
"postcss-scss": "^0.1.7",
"postcss-shape": "^0.0.1",
"postcss-short": "^1.4.0",
"postcss-utils": "^1.0.1",
"postcss-loader": "^1.3.3",
"precss": "^1.4.0",
"prismjs": "^1.5.1",
"progress-bar-webpack-plugin": "^1.9.3",

7014
yarn.lock Normal file

File diff suppressed because it is too large Load Diff