├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── build ├── build.js ├── check-versions.js ├── dev-client.js ├── dev-server.js ├── markdown.config.js ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── index.html ├── package.json ├── src ├── App.vue ├── app.js ├── assets │ ├── logo.png │ └── vue-admin │ │ ├── charts.PNG │ │ ├── components.PNG │ │ ├── form.PNG │ │ ├── logo.svg │ │ ├── tables.PNG │ │ └── vue-admin.PNG ├── components │ ├── DemoSection.vue │ ├── FooterBar.vue │ ├── Navbar.vue │ ├── SideBar.vue │ └── layout.js ├── docs │ ├── en-US │ │ ├── Button.md │ │ ├── Collapse.md │ │ ├── Icon.md │ │ └── Install.md │ └── zh-CN │ │ ├── Button.md │ │ ├── Collapse.md │ │ ├── Icon.md │ │ └── Install.md ├── i18n │ ├── langs.js │ └── locales │ │ ├── en-US.js │ │ ├── index.js │ │ └── zh-CN.js ├── main.js ├── router │ ├── index.js │ └── manual.js ├── store │ ├── actions.js │ ├── getters.js │ ├── index.js │ ├── modules │ │ └── app.js │ └── mutation-types.js ├── styles │ ├── api-table.css │ └── code-md.css ├── utils │ ├── anchor.js │ └── lazyLoading.js └── views │ ├── Demo.vue │ ├── Home.vue │ └── Manual.vue └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": [ 7 | "transform-export-extensions" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | site 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Fangdun Cai (fundone.me) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-bulma 2 | 3 | Vue Bulma Tour 4 | 5 | # Page List 6 | 7 | - [ ] Main frame 60% 8 | - [ ] Markitdown 80% 9 | - [ ] Router config 50% 10 | - [ ] Home page 10% 11 | - [ ] Demo page 70% 12 | - [ ] Manual page 80% 13 | 14 | # Doc List ch/en 15 | - [ ] Buttons 16 | - [ ] Chartist 17 | - [ ] Chartjs 18 | - [ ] Peity 19 | - [ ] Plotly 20 | - [ ] Icons 21 | - [ ] Typography 22 | - [ ] Input 23 | - [ ] Select 24 | - [ ] Form & Validation 25 | - [ ] Cleavejs 26 | - [ ] BackToTop 27 | - [ ] Brace 28 | - [ ] Collapse 29 | - [ ] Datepicker 30 | - [ ] Emoji 31 | - [ ] Message 32 | - [ ] Modal 33 | - [ ] Notification 34 | - [ ] ProgressBar 35 | - [ ] ProgressTracker 36 | - [ ] Quil 37 | - [ ] Rating 38 | - [ ] Slider 39 | - [ ] Switch 40 | - [ ] Tabs 41 | - [ ] Tooltip 42 | - [ ] Lory 43 | - [ ] Basic Table 44 | - [ ] Pagination 45 | 46 | # Vue bulma Components 47 | - [ ] Affix 48 | - [ ] Input: with suggestion 49 | - [ ] Citypicker 50 | - [ ] Select: with muti texts inside an option 51 | - [ ] Button: wrapper 52 | - [ ] CheckBox 53 | - [ ] Cascader 54 | - [ ] Form validation 55 | - [ ] Badage/tag 56 | - [ ] Tree 57 | - [ ] Popbox 58 | 59 | ## Badges 60 | 61 | ![](https://img.shields.io/badge/license-MIT-blue.svg) 62 | ![](https://img.shields.io/badge/status-dev-yellow.svg) 63 | 64 | 65 | ## License 66 | 67 | MIT 68 | 69 | 70 | ## PS 71 | Too busy with daily work...白天太特么忙了... 72 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | // https://github.com/shelljs/shelljs 2 | 'use strict' 3 | 4 | require('./check-versions')() 5 | require('shelljs/global') 6 | 7 | env.NODE_ENV = 'production' 8 | 9 | const ora = require('ora') 10 | const path = require('path') 11 | const chalk = require('chalk') 12 | const webpack = require('webpack') 13 | const config = require('../config') 14 | const webpackConfig = require('./webpack.prod.conf') 15 | 16 | const spinner = ora('building for production...') 17 | spinner.start() 18 | 19 | const assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory) 20 | rm('-rf', assetsPath) 21 | mkdir('-p', assetsPath) 22 | cp('-R', 'assets/*', assetsPath) 23 | 24 | const compiler = webpack(webpackConfig) 25 | const ProgressPlugin = require('webpack/lib/ProgressPlugin') 26 | compiler.apply(new ProgressPlugin()) 27 | 28 | compiler.run((err, stats) => { 29 | spinner.stop() 30 | if (err) throw err 31 | process.stdout.write(stats.toString({ 32 | colors: true, 33 | modules: false, 34 | children: false, 35 | chunks: false, 36 | chunkModules: false 37 | }) + '\n\n') 38 | 39 | console.log(chalk.cyan(' Build complete.\n')) 40 | console.log(chalk.yellow( 41 | ' Tip: built files are meant to be served over an HTTP server.\n' + 42 | ' Opening index.html over file:// won\'t work.\n' 43 | )) 44 | }) 45 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const chalk = require('chalk') 4 | const semver = require('semver') 5 | const packageConfig = require('../package.json') 6 | 7 | const exec = (cmd) => { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | }, 17 | { 18 | name: 'npm', 19 | currentVersion: exec('npm --version'), 20 | versionRequirement: packageConfig.engines.npm 21 | } 22 | ] 23 | 24 | module.exports = () => { 25 | const warnings = [] 26 | for (let i = 0; i < versionRequirements.length; i++) { 27 | const mod = versionRequirements[i] 28 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 29 | warnings.push(mod.name + ': ' + 30 | chalk.red(mod.currentVersion) + ' should be ' + 31 | chalk.green(mod.versionRequirement) 32 | ) 33 | } 34 | } 35 | 36 | if (warnings.length) { 37 | console.log('') 38 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 39 | console.log() 40 | for (let i = 0; i < warnings.length; i++) { 41 | const warning = warnings[i] 42 | console.log(' ' + warning) 43 | } 44 | console.log() 45 | process.exit(1) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /build/dev-client.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | /* eslint-disable */ 4 | require('eventsource-polyfill') 5 | const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 6 | 7 | hotClient.subscribe(event => { 8 | if (event.action === 'reload') { 9 | window.location.reload() 10 | } 11 | }) 12 | -------------------------------------------------------------------------------- /build/dev-server.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | require('./check-versions')() 4 | 5 | const path = require('path') 6 | const express = require('express') 7 | const webpack = require('webpack') 8 | const opn = require('opn') 9 | const config = require('../config') 10 | const proxyMiddleware = require('http-proxy-middleware') 11 | const webpackConfig = process.env.NODE_ENV === 'testing' 12 | ? require('./webpack.prod.conf') 13 | : require('./webpack.dev.conf') 14 | 15 | // default port where dev server listens for incoming traffic 16 | const port = process.env.PORT || config.dev.port 17 | // automatically open browser, if not set will be false 18 | const autoOpenBrowser = Boolean(config.dev.autoOpenBrowser) 19 | // Define HTTP proxies to your custom API backend 20 | // https://github.com/chimurai/http-proxy-middleware 21 | const proxyTable = config.dev.proxyTable 22 | 23 | const app = express() 24 | const compiler = webpack(webpackConfig) 25 | 26 | const devMiddleware = require('webpack-dev-middleware')(compiler, { 27 | publicPath: webpackConfig.output.publicPath, 28 | stats: { 29 | colors: true, 30 | chunks: false 31 | } 32 | }) 33 | 34 | const hotMiddleware = require('webpack-hot-middleware')(compiler) 35 | // force page reload when html-webpack-plugin template changes 36 | compiler.plugin('compilation', compilation => { 37 | compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => { 38 | hotMiddleware.publish({ action: 'reload' }) 39 | cb() 40 | }) 41 | }) 42 | 43 | // proxy api requests 44 | Object.keys(proxyTable).forEach(context => { 45 | let options = proxyTable[context] 46 | if (typeof options === 'string') { 47 | options = { target: options } 48 | } 49 | app.use(proxyMiddleware(options.filter || context, options)) 50 | }) 51 | 52 | // handle fallback for HTML5 history API 53 | app.use(require('connect-history-api-fallback')()) 54 | 55 | // serve webpack bundle output 56 | app.use(devMiddleware) 57 | 58 | // enable hot-reload and state-preserving 59 | // compilation error display 60 | app.use(hotMiddleware) 61 | 62 | // serve pure static assets 63 | const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 64 | app.use(staticPath, express.static('./assets')) 65 | 66 | const uri = 'http://localhost:' + port 67 | 68 | devMiddleware.waitUntilValid(() => { 69 | console.log('> Listening at ' + uri + '\n') 70 | }) 71 | 72 | module.exports = app.listen(port, err => { 73 | if (err) { 74 | console.log(err) 75 | return 76 | } 77 | 78 | // when env is testing, don't need open it 79 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 80 | opn(uri) 81 | } 82 | }) 83 | -------------------------------------------------------------------------------- /build/markdown.config.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * strip-tags 3 | * 4 | * Copyright (c) 2015 Jon Schlinkert, contributors. 5 | * Licensed under the MIT license. 6 | */ 7 | 'use strict' 8 | 9 | const cheerio = require('cheerio') 10 | const slugify = require('transliteration').slugify 11 | const hljs = require('highlight.js') 12 | const markdown = require('markdown-it')({ 13 | html: true, 14 | breaks: true, 15 | highlight: function (str, lang) { 16 | if (!(lang && hljs.getLanguage(lang))) { 17 | return '' 18 | } 19 | 20 | try { 21 | return hljs.highlight(lang, str, true).value.replace(/({{|}})/g, '$1') 22 | } catch (err) {} 23 | } 24 | }) 25 | 26 | function strip(str, tags) { 27 | if (!tags || tags.length === 0) { 28 | return str 29 | } 30 | 31 | const $ = cheerio.load(str, { 32 | decodeEntities: false 33 | }) 34 | 35 | tags = !Array.isArray(tags) ? [tags] : tags 36 | 37 | tags.forEach((tag) => { 38 | $(tags).remove() 39 | }) 40 | 41 | return $.html() 42 | } 43 | 44 | function fetch(str, tag) { 45 | if (!tag) { 46 | return str 47 | } 48 | 49 | const $ = cheerio.load(str, { 50 | decodeEntities: false 51 | }) 52 | 53 | return $(tag).html() 54 | } 55 | 56 | function convert(str) { 57 | str = str.replace(/(&#x)(\w{4});/gi, function($0) { 58 | return String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)) 59 | }) 60 | return str 61 | } 62 | 63 | markdown.use(require('markdown-it-anchor'), { 64 | level: 1, 65 | slugify: slugify, 66 | permalink: true, 67 | permalinkBefore: true, 68 | permalinkSymbol: '#' 69 | }).use(require('markdown-it-container'), 'demo', { 70 | validate(params) { 71 | return params.trim().match(/^demo\s*(.*)$/) 72 | }, 73 | render(tokens, idx) { 74 | const m = tokens[idx].info.trim().match(/^demo\s*(.*)$/) 75 | if (tokens[idx].nesting === 1) { 76 | const summary = (m && m.length > 1) ? m[1].split('|') : [] 77 | const token = tokens[idx + 1] 78 | const content = tokens[idx + 1].content 79 | const html = convert(strip(content, ['script', 'style'])).replace(/(<[^>]*)=""(?=.*>)/g, '$1') 80 | const script = fetch(content, 'script') 81 | const style = fetch(content, 'style') 82 | const code = token.markup + token.info + '\n' + content + token.markup 83 | const codeHtml = code ? markdown.render(code) : '' 84 | 85 | summary.length = 2 86 | const subtitleHTML = summary[0] || '无标题示例' 87 | const descriptionHTML = summary[1] ? markdown.render(summary[1]) : '无描述信息' 88 | 89 | let jsfiddle = { html: html, script: script, style: style } 90 | jsfiddle = markdown.utils.escapeHtml(JSON.stringify(jsfiddle)) 91 | 92 | return ` 93 |

${html}

94 |

${codeHtml}

95 |
${descriptionHTML}
` 96 | } 97 | 98 | return '
\n' 99 | } 100 | }) 101 | 102 | exports = module.exports = markdown 103 | -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | const config = require('../config') 5 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 6 | 7 | exports.assetsPath = _path => { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | return path.posix.join(assetsSubDirectory, _path) 12 | } 13 | 14 | exports.cssLoaders = options => { 15 | options = options || {} 16 | // generate loader string to be used with extract text plugin 17 | const generateLoaders = loaders => { 18 | const sourceLoader = loaders.map(loader => { 19 | let extraParamChar 20 | if (/\?/.test(loader)) { 21 | loader = loader.replace(/\?/, '-loader?') 22 | extraParamChar = '&' 23 | } else { 24 | loader = loader + '-loader' 25 | extraParamChar = '?' 26 | } 27 | return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '') 28 | }).join('!') 29 | 30 | // Extract CSS when that option is specified 31 | // (which is the case during production build) 32 | if (options.extract) { 33 | return ExtractTextPlugin.extract({ 34 | use: sourceLoader, 35 | fallback: 'vue-style-loader' 36 | }) 37 | } else { 38 | return ['vue-style-loader', sourceLoader].join('!') 39 | } 40 | } 41 | 42 | // http://vuejs.github.io/vue-loader/configurations/extract-css.html 43 | return { 44 | css: generateLoaders(['css']), 45 | postcss: generateLoaders(['css']), 46 | less: generateLoaders(['css', 'less']), 47 | sass: generateLoaders(['css', 'sass?indentedSyntax']), 48 | scss: generateLoaders(['css', 'sass']), 49 | stylus: generateLoaders(['css', 'stylus']), 50 | styl: generateLoaders(['css', 'stylus']) 51 | } 52 | } 53 | 54 | // Generate loaders for standalone style files (outside of .vue) 55 | exports.styleLoaders = options => { 56 | const output = [] 57 | const loaders = exports.cssLoaders(options) 58 | for (const extension of Object.keys(loaders)) { 59 | const loader = loaders[extension] 60 | output.push({ 61 | test: new RegExp('\\.' + extension + '$'), 62 | loader: loader 63 | }) 64 | } 65 | return output 66 | } 67 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | 6 | const isProduction = process.env.NODE_ENV === 'production' 7 | 8 | module.exports = { 9 | loaders: utils.cssLoaders({ 10 | sourceMap: isProduction ? config.build.productionSourceMap : config.dev.cssSourceMap, 11 | extract: isProduction 12 | }), 13 | postcss: [ 14 | require('autoprefixer')({ 15 | browsers: ['last 3 versions'] 16 | }) 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | const config = require('../config') 5 | const utils = require('./utils') 6 | const projectRoot = path.resolve(__dirname, '../') 7 | const docPath = path.resolve(__dirname, '../src/docs') 8 | const markdown = require('./markdown.config') 9 | 10 | module.exports = { 11 | entry: { 12 | app: ['./src/main.js'], 13 | // If you want to support IE < 11, should add `babel-polyfill` to vendor. 14 | // e.g. ['babel-polyfill', 'vue', 'vue-router', 'vuex'] 15 | vendor: ['vue', 'vue-router', 'vuex'] 16 | }, 17 | output: { 18 | path: config.build.assetsRoot, 19 | publicPath: process.env.NODE_ENV === 'production' 20 | ? config.build.assetsPublicPath 21 | : config.dev.assetsPublicPath, 22 | filename: '[name].js' 23 | }, 24 | resolve: { 25 | extensions: ['.js', '.vue', '.css', '.json'], 26 | alias: { 27 | src: path.resolve(__dirname, '../src'), 28 | assets: path.resolve(__dirname, '../src/assets'), 29 | components: path.resolve(__dirname, '../src/components'), 30 | views: path.resolve(__dirname, '../src/views'), 31 | docs: path.resolve(__dirname, '../src/docs'), 32 | i18n: path.resolve(__dirname, '../src/i18n'), 33 | 'vuex-store': path.resolve(__dirname, '../src/store') 34 | } 35 | }, 36 | module: { 37 | loaders: [ 38 | { 39 | test: /\.vue$/, 40 | loader: 'vue-loader', 41 | options: require('./vue-loader.conf') 42 | }, 43 | { 44 | test: /\.js$/, 45 | loader: 'babel-loader', 46 | include: projectRoot, 47 | // /node_modules\/(?!vue-bulma-.*)/ 48 | exclude: [new RegExp(`node_modules\\${path.sep}(?!vue-bulma-.*)`)] 49 | }, 50 | { 51 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 52 | loader: 'url-loader', 53 | query: { 54 | limit: 10000, 55 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 56 | } 57 | }, 58 | { 59 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 60 | loader: 'url-loader', 61 | query: { 62 | limit: 10000, 63 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 64 | } 65 | }, 66 | { 67 | test: /\.md/, 68 | loader: 'vue-markdown-loader', 69 | include: docPath, 70 | exclude: /node_modules/, 71 | options: markdown 72 | } 73 | ] 74 | }, 75 | // See https://github.com/webpack/webpack/issues/3486 76 | performance: { 77 | hints: false 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const webpack = require('webpack') 4 | const merge = require('webpack-merge') 5 | const HtmlWebpackPlugin = require('html-webpack-plugin') 6 | const baseWebpackConfig = require('./webpack.base.conf') 7 | const config = require('../config') 8 | const utils = require('./utils') 9 | 10 | // add hot-reload related code to entry chunks 11 | Object.keys(baseWebpackConfig.entry).forEach(name => { 12 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 13 | }) 14 | 15 | module.exports = merge(baseWebpackConfig, { 16 | module: { 17 | loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 18 | }, 19 | // eval-source-map is faster for development 20 | devtool: '#eval-source-map', 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': config.dev.env 24 | }), 25 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 26 | new webpack.HotModuleReplacementPlugin(), 27 | new webpack.NoEmitOnErrorsPlugin(), 28 | // extract vendor chunks for better caching 29 | new webpack.optimize.CommonsChunkPlugin({ 30 | name: 'vendor', 31 | filename: 'vendor.js' 32 | }), 33 | // https://github.com/ampedandwired/html-webpack-plugin 34 | new HtmlWebpackPlugin({ 35 | title: 'Vue Bulma Tutorial', 36 | filename: 'index.html', 37 | template: 'index.html', 38 | inject: true, 39 | favicon: 'src/assets/logo.png' 40 | }) 41 | ] 42 | }) 43 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | const webpack = require('webpack') 5 | const merge = require('webpack-merge') 6 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 7 | const HtmlWebpackPlugin = require('html-webpack-plugin') 8 | const baseWebpackConfig = require('./webpack.base.conf') 9 | const config = require('../config') 10 | const utils = require('./utils') 11 | const env = process.env.NODE_ENV === 'testing' 12 | ? require('../config/test.env') 13 | : config.build.env 14 | const isELECTRON = process.env.NODE_ELECTRON === 'true' 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | loaders: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true 21 | }) 22 | }, 23 | devtool: config.build.productionSourceMap ? '#source-map' : false, 24 | output: { 25 | path: config.build.assetsRoot, 26 | publicPath: isELECTRON ? path.join(__dirname, '../dist/') : '/', 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new webpack.LoaderOptionsPlugin({ 36 | minimize: true 37 | }), 38 | new webpack.optimize.UglifyJsPlugin({ 39 | 'screw-ie8': true, 40 | sourceMap: true, 41 | compress: { 42 | warnings: false 43 | }, 44 | output: { 45 | comments: false 46 | } 47 | }), 48 | // extract css into its own file 49 | new ExtractTextPlugin(utils.assetsPath('css/[name].[contenthash].css')), 50 | // generate dist index.html with correct asset hash for caching. 51 | // you can customize output by editing /index.html 52 | // see https://github.com/ampedandwired/html-webpack-plugin 53 | new HtmlWebpackPlugin({ 54 | title: 'Vue Bulma Tutorial', 55 | filename: process.env.NODE_ENV === 'testing' 56 | ? 'index.html' 57 | : config.build.index, 58 | template: 'index.html', 59 | inject: true, 60 | favicon: 'src/assets/logo.png', 61 | minify: { 62 | removeComments: true, 63 | collapseWhitespace: true, 64 | removeAttributeQuotes: true 65 | // more options: 66 | // https://github.com/kangax/html-minifier#options-quick-reference 67 | }, 68 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 69 | chunksSortMode: 'dependency' 70 | }), 71 | // split vendor js into its own file 72 | new webpack.optimize.CommonsChunkPlugin({ 73 | name: 'vendor', 74 | minChunks (module, count) { 75 | // any required modules inside node_modules are extracted to vendor 76 | return ( 77 | module.resource && 78 | /\.js$/.test(module.resource) && 79 | module.resource.indexOf( 80 | path.join(__dirname, '../node_modules') 81 | ) === 0 82 | ) 83 | } 84 | }), 85 | // extract webpack runtime and module manifest to its own file in order to 86 | // prevent vendor hash from being updated whenever app bundle is updated 87 | new webpack.optimize.CommonsChunkPlugin({ 88 | name: 'manifest', 89 | chunks: ['vendor'] 90 | }) 91 | ] 92 | }) 93 | 94 | if (config.build.productionGzip) { 95 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 96 | 97 | webpackConfig.plugins.push( 98 | new CompressionWebpackPlugin({ 99 | asset: '[path].gz[query]', 100 | algorithm: 'gzip', 101 | test: new RegExp( 102 | '\\.(' + 103 | config.build.productionGzipExtensions.join('|') + 104 | ')$' 105 | ), 106 | threshold: 10240, 107 | minRatio: 0.8 108 | }) 109 | ) 110 | } 111 | 112 | module.exports = webpackConfig 113 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const merge = require('webpack-merge') 4 | const prodEnv = require('./prod.env') 5 | 6 | module.exports = merge(prodEnv, { 7 | NODE_ENV: '"development"' 8 | }) 9 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | const path = require('path') 5 | 6 | module.exports = { 7 | build: { 8 | env: require('./prod.env'), 9 | index: path.resolve(__dirname, '../dist/index.html'), 10 | assetsRoot: path.resolve(__dirname, '../dist'), 11 | assetsSubDirectory: 'assets', 12 | assetsPublicPath: '/', 13 | productionSourceMap: true, 14 | // Gzip off by default as many popular static hosts such as 15 | // Surge or Netlify already gzip all static assets for you. 16 | // Before setting to `true`, make sure to: 17 | // npm install --save-dev compression-webpack-plugin 18 | productionGzip: false, 19 | productionGzipExtensions: ['js', 'css'] 20 | }, 21 | dev: { 22 | env: require('./dev.env'), 23 | port: process.env.DEV_PORT || 8080, 24 | autoOpenBrowser: true, 25 | assetsSubDirectory: 'assets', 26 | assetsPublicPath: '/', 27 | proxyTable: { 28 | '/MODApis': { 29 | target: 'http://dev.markitondemand.com', 30 | changeOrigin: true 31 | } 32 | }, 33 | // CSS Sourcemaps off by default because relative paths are "buggy" 34 | // with this option, according to the CSS-Loader README 35 | // (https://github.com/webpack/css-loader#sourcemaps) 36 | // In our experience, they generally work as expected, 37 | // just be aware of this issue when enabling this option. 38 | cssSourceMap: false 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | NODE_ENV: '"production"' 5 | } 6 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const merge = require('webpack-merge') 4 | const devEnv = require('./dev.env') 5 | 6 | module.exports = merge(devEnv, { 7 | NODE_ENV: '"testing"' 8 | }) 9 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= htmlWebpackPlugin.options.title %> 8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-bulma-tutorial", 3 | "version": "0.0.1", 4 | "description": "Tutorial of Vue Bulma and related components", 5 | "repository": "vue-bulma/vue-bulma-tutorial", 6 | "license": "MIT", 7 | "author": { 8 | "name": "Luventa (Pan Yue)", 9 | "email": "luventa@outlook.com", 10 | "url": "https://github.com/luventa" 11 | }, 12 | "main": "src/index.js", 13 | "keywords": [ 14 | "tour", 15 | "tutorial", 16 | "bulma", 17 | "vue-bulma", 18 | "components" 19 | ], 20 | "engines": { 21 | "node": ">=4", 22 | "npm": ">=3" 23 | }, 24 | "scripts": { 25 | "build": "rimraf site && cross-env NODE_ENV=production webpack --config build/webpack.config.js --progress", 26 | "build:open": "http-server -p 8000 site/", 27 | "deploy": "gh-pages -d site", 28 | "dev": "cross-env NODE_ENV=development node build/dev-server.js" 29 | }, 30 | "dependencies": { 31 | "animate.css": "^3.5.2", 32 | "bulma": "^0.3.1", 33 | "font-awesome": "4.7.0", 34 | "hover.css": "^2.0.2", 35 | "smooth-scroll": "cferdinandi/smooth-scroll", 36 | "vue": "^2.2.1", 37 | "vue-bulma-brace": "^0.1.0", 38 | "vue-bulma-breadcrumb": "^1.0.1", 39 | "vue-bulma-card": "^1.0.2", 40 | "vue-bulma-chartist": "^1.1.0", 41 | "vue-bulma-chartjs": "^1.0.4", 42 | "vue-bulma-collapse": "1.0.3", 43 | "vue-bulma-datepicker": "^1.2.8", 44 | "vue-bulma-emoji": "^0.0.2", 45 | "vue-bulma-expanding": "^0.0.1", 46 | "vue-bulma-jump": "^0.0.2", 47 | "vue-bulma-message": "^1.1.1", 48 | "vue-bulma-modal": "1.0.1", 49 | "vue-bulma-notification": "^1.1.1", 50 | "vue-bulma-progress-bar": "^1.0.1", 51 | "vue-bulma-progress-tracker": "0.0.4", 52 | "vue-bulma-quill": "0.0.1", 53 | "vue-bulma-rating": "^1.0.1", 54 | "vue-bulma-slider": "^1.0.2", 55 | "vue-bulma-switch": "^1.0.4", 56 | "vue-bulma-tabs": "^1.1.2", 57 | "vue-bulma-tooltip": "^1.0.3", 58 | "vue-cleave": "1.1.1", 59 | "vue-handsontable": "^0.0.1", 60 | "vue-i18n": "^6.0.0-alpha.2", 61 | "vue-lory": "0.0.4", 62 | "vue-nprogress": "0.1.5", 63 | "vue-peity": "0.5.0", 64 | "vue-router": "^2.3.0", 65 | "vuex": "^2.2.1", 66 | "vuex-router-sync": "^4.1.2" 67 | }, 68 | "devDependencies": { 69 | "autoprefixer": "^6.7.6", 70 | "babel-core": "^6.21.0", 71 | "babel-eslint": "^7.1.1", 72 | "babel-loader": "^6.2.10", 73 | "babel-plugin-transform-export-extensions": "^6.8.0", 74 | "babel-preset-es2015": "^6.14.0", 75 | "babel-preset-stage-2": "^6.17.0", 76 | "cheerio": "^0.22.0", 77 | "connect-history-api-fallback": "^1.3.0", 78 | "cross-env": "^3.1.4", 79 | "css-loader": "^0.26.1", 80 | "es6-promise": "^4.1.0", 81 | "eventsource-polyfill": "^0.9.6", 82 | "express": "^4.14.0", 83 | "extract-text-webpack-plugin": "^2.0.0-beta.4", 84 | "file-loader": "^0.10.1", 85 | "highlight.js": "^9.9.0", 86 | "html-webpack-plugin": "^2.26.0", 87 | "http-proxy-middleware": "^0.17.3", 88 | "imports-loader": "^0.7.0", 89 | "markdown-it": "^8.3.1", 90 | "markdown-it-anchor": "^4.0.0", 91 | "markdown-it-container": "^2.0.0", 92 | "node-sass": "^4.2.0", 93 | "opn": "^4.0.2", 94 | "ora": "^1.1.0", 95 | "progress-bar-webpack-plugin": "^1.9.1", 96 | "rimraf": "2.5.4", 97 | "sass-loader": "^6.0.2", 98 | "serve-favicon": "^2.4.1", 99 | "style-loader": "^0.13.1", 100 | "transliteration": "^1.5.3", 101 | "url-loader": "0.5.7", 102 | "vue-html-loader": "^1.2.3", 103 | "vue-loader": "^11.0.0", 104 | "vue-markdown-loader": "^0.6.2", 105 | "vue-template-compiler": "^2.2.1", 106 | "webpack": "^2.2.1", 107 | "webpack-dev-middleware": "^1.9.0", 108 | "webpack-hot-middleware": "^2.14.0", 109 | "webpack-merge": "^3.0.0" 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 55 | 56 | 110 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueI18n from 'vue-i18n' 3 | import NProgress from 'vue-nprogress' 4 | import DemoSection from 'components/DemoSection' 5 | import { sync } from 'vuex-router-sync' 6 | import App from './App.vue' 7 | import router from './router' 8 | import store from './store' 9 | import { TOGGLE_PAGE, TOGGLE_SIDEBAR } from 'vuex-store/mutation-types' 10 | import locales from 'i18n/locales' 11 | import Promise from 'es6-promise' 12 | 13 | Promise.polyfill() 14 | Vue.use(NProgress) 15 | Vue.use(VueI18n) 16 | Vue.component('demo-section', DemoSection) 17 | 18 | const i18n = new VueI18n({ 19 | locale: 'zh-CN', 20 | messages: locales 21 | }) 22 | 23 | 24 | // Enable devtools 25 | Vue.config.devtools = true 26 | 27 | sync(store, router) 28 | 29 | const nprogress = new NProgress({ parent: '.nprogress-container' }) 30 | 31 | const { state } = store 32 | 33 | router.beforeEach((route, redirect, next) => { 34 | store.commit(TOGGLE_PAGE, route.path.split('/')[1]) 35 | if (state.app.device.isMobile && state.app.sidebar.opened) { 36 | store.commit(TOGGLE_SIDEBAR, false) 37 | } 38 | next() 39 | }) 40 | 41 | const app = new Vue({ 42 | i18n, 43 | router, 44 | store, 45 | nprogress, 46 | ...App 47 | }) 48 | 49 | export { app, router, store } 50 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/vue-admin/charts.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/vue-admin/charts.PNG -------------------------------------------------------------------------------- /src/assets/vue-admin/components.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/vue-admin/components.PNG -------------------------------------------------------------------------------- /src/assets/vue-admin/form.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/vue-admin/form.PNG -------------------------------------------------------------------------------- /src/assets/vue-admin/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | vue-admin 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/assets/vue-admin/tables.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/vue-admin/tables.PNG -------------------------------------------------------------------------------- /src/assets/vue-admin/vue-admin.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vue-bulma/vue-bulma-tutorial/2033d69d0b7b2756e6634cec7caabdc812a943a4/src/assets/vue-admin/vue-admin.PNG -------------------------------------------------------------------------------- /src/components/DemoSection.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 55 | 115 | 116 | 122 | -------------------------------------------------------------------------------- /src/components/FooterBar.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 33 | -------------------------------------------------------------------------------- /src/components/Navbar.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 105 | 106 | 197 | -------------------------------------------------------------------------------- /src/components/SideBar.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 119 | 120 | 216 | -------------------------------------------------------------------------------- /src/components/layout.js: -------------------------------------------------------------------------------- 1 | import Navbar from './Navbar' 2 | 3 | import FooterBar from './FooterBar' 4 | 5 | export { Navbar, FooterBar } 6 | -------------------------------------------------------------------------------- /src/docs/en-US/Button.md: -------------------------------------------------------------------------------- 1 | # Button 2 | 3 | Basic component works for triggering bussiness transition. Class `button` can convert element to button. 4 | 5 | --- 6 | ::: tile aaaaa 7 | ::: demo 色调样式|色调样式包括白、浅色、深色和黑色。通过设置样式 `is-white` `is-light` `is-dark` 或 `is-black` 来设定。 8 | 9 | ```html 10 | 18 | ``` 19 | ::: 20 | 21 | ::: demo 功能类型|除了基本按钮 `button` 按钮外,功能类型还包括主要按钮、信息按钮、成功按钮、警告按钮、危险按钮和链接按钮。通过设置样式 `is-primary` `is-info` `is-success` `is-warning` `is-danger` `is-link` 来设定。 22 | 23 | ```html 24 | 35 | ``` 36 | ::: 37 | 38 | ::: demo 尺寸|除了普通尺寸外,按钮尺寸目前还包括 `is-small` 小、 `is-medium` 中等和 `is-large` 大。 39 | 40 | ```html 41 | 49 | ``` 50 | ::: 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/docs/en-US/Collapse.md: -------------------------------------------------------------------------------- 1 | # 折叠组件 2 | 3 | 折叠组件用于在页面内容较多时,隐藏部分不重要数据,仅显示标题或重点信息,指引用户自行点击查阅。 4 | 需要从`vue-bulma-collapse`中引入组件 `Collapse` 和 `Item` 5 | 本示例中将 `Item` 引入并重新命名为 `CollapseItem` 6 | 7 | 17 | 18 | --- 19 | 20 | ::: demo 内嵌折叠|在 `item` 标签中再次使用 `collapse` 可以进行内嵌折叠。示例中 21 | 22 | ```html 23 | 40 | ``` 41 | ::: 42 | 43 | ## Collapse Item Attrs 44 | 45 | | Name | Type | Desc | 46 | |------|----|--------| 47 | | selected | Boolean | Is item expanded.
default:`false` | 48 | | title | String | Title of item. Required. | 49 | -------------------------------------------------------------------------------- /src/docs/en-US/Icon.md: -------------------------------------------------------------------------------- 1 | # Icon 2 | content here 3 | -------------------------------------------------------------------------------- /src/docs/en-US/Install.md: -------------------------------------------------------------------------------- 1 | # Install -------------------------------------------------------------------------------- /src/docs/zh-CN/Button.md: -------------------------------------------------------------------------------- 1 | # 按钮 2 | 3 | 基础组件,用于触发业务逻辑。使用样式 `button` 将元素转化为按钮 4 | 5 | --- 6 | 7 | ::: demo 色调样式|色调样式包括白、浅色、深色和黑色。通过设置样式 `is-white` `is-light` `is-dark` 或 `is-black` 来设定。 8 | 9 | ```html 10 | 18 | ``` 19 | ::: 20 | 21 | ::: demo 功能类型|除了基本按钮 `button` 按钮外,功能类型还包括主要按钮、信息按钮、成功按钮、警告按钮、危险按钮和链接按钮。通过设置样式 `is-primary` `is-info` `is-success` `is-warning` `is-danger` `is-link` 来设定。 22 | 23 | ```html 24 | 35 | ``` 36 | ::: 37 | 38 | ::: demo 尺寸|除了普通尺寸外,按钮尺寸目前还包括 `is-small` 小、 `is-medium` 中等和 `is-large` 大。 39 | 40 | ```html 41 | 49 | ``` 50 | ::: 51 | 52 | -------------------------------------------------------------------------------- /src/docs/zh-CN/Collapse.md: -------------------------------------------------------------------------------- 1 | ## 折叠组件 2 | 3 | 折叠组件用于在页面内容较多时,隐藏部分不重要数据,仅显示标题或重点信息,指引用户自行点击查阅。需要从`vue-bulma-collapse`中引入组件 `Collapse` 和 `Item` 4 | 本示例中将 `Item` 引入并重新命名为 `CollapseItem` 5 | 6 | 16 | 17 | --- 18 | 19 | ::: demo 内嵌折叠|在 `item` 标签中再次使用 `collapse` 可以进行内嵌折叠。示例中 20 | 21 | ```html 22 | 39 | ``` 40 | ::: 41 | 42 | ## Collapse Item 属性 43 | 44 | | 名称 | 类型 | 说明 | 45 | |------|----|--------| 46 | | selected | Boolean | 折叠面板是否展开
默认值:`false` | 47 | | title | String | 折叠面板的标题,必填 | 48 | -------------------------------------------------------------------------------- /src/docs/zh-CN/Icon.md: -------------------------------------------------------------------------------- 1 | # 图标 2 | content here 3 | -------------------------------------------------------------------------------- /src/docs/zh-CN/Install.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | 3 | 在使用Vue Bulma的组件前,需要做一些有一点点麻烦的前置准备 4 | -------------------------------------------------------------------------------- /src/i18n/langs.js: -------------------------------------------------------------------------------- 1 | export default { 2 | 'zh-CN': '简体中文', 3 | 'en-US': 'English' 4 | } -------------------------------------------------------------------------------- /src/i18n/locales/en-US.js: -------------------------------------------------------------------------------- 1 | export default { 2 | header: { 3 | desc: 'hashahaha', 4 | nav: ['demo', 'manual', 'tanslation'] 5 | }, 6 | home: { 7 | brief: [ 8 | 'Flexible', 9 | ' UI Components', 10 | 'mainly based on', 11 | 'for building', 12 | 'Reactive Webapp', 13 | 'on all devices', 14 | 'Demo', 15 | 'Manual' 16 | ] 17 | }, 18 | demo: { 19 | vueadmin: { 20 | desc: 'Admin Panel Framework.', 21 | charts: 'Excellent Charts', 22 | form: 'Multiform Form Controls', 23 | components: 'Various Components', 24 | tables: 'Useful Tables' 25 | } 26 | }, 27 | manual: { 28 | install: 'Install', 29 | basic: 'Basic', 30 | button: 'Buttons', 31 | icon: 'Icons', 32 | interact: 'Interact', 33 | collapse: 'Collapse' 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/i18n/locales/index.js: -------------------------------------------------------------------------------- 1 | import zhcn from './zh-CN' 2 | import enus from './en-US' 3 | 4 | export default { 5 | 'zh-CN': zhcn, 6 | 'en-US': enus 7 | } -------------------------------------------------------------------------------- /src/i18n/locales/zh-CN.js: -------------------------------------------------------------------------------- 1 | export default { 2 | header: { 3 | desc: '丰富的响应式组件库', 4 | nav: ['示例', '手册', '多语言'] 5 | }, 6 | home: { 7 | brief: [ 8 | '灵活的', 9 | 'UI组件库', 10 | '基于', 11 | '可用于开发', 12 | '兼容所有设备类型的', 13 | '响应式的Webapp', 14 | '查看示例', 15 | '使用手册' 16 | ] 17 | }, 18 | demo: { 19 | vueadmin: { 20 | desc: '管理控制台框架', 21 | charts: '出色的图表', 22 | form: '各类表单控件', 23 | components: '丰富的组件', 24 | tables: '实用的表格' 25 | } 26 | }, 27 | manual: { 28 | install: '安装使用', 29 | basic: '基础组件', 30 | button: '按钮', 31 | icon: '图标', 32 | interact: '交互组件', 33 | collapse: '折叠组件' 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import { app } from './app' 2 | 3 | app.$mount('#app') 4 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import locales from 'i18n/locales' 4 | import manual from './manual' 5 | import { loadView, loadDoc} from 'src/utils/lazyLoading' 6 | Vue.use(Router) 7 | 8 | const defaultPath = '/zh-CN' 9 | 10 | function generateRouteByLang (items, lang, routes = []) { 11 | for (let i = 0, l = items.length; i < l; i++) { 12 | let item = items[i] 13 | if (item.name && !item.lableOnly) { 14 | routes.push({ 15 | name: item.name + '-' + lang, 16 | path: item.path ? (lang + item.path) : (lang + '/' + item.name.toLowerCase()), 17 | component: loadDoc(item.name, lang), 18 | meta: { 19 | label: locales[lang][item.name.toLowerCase()], 20 | icon: item.icon 21 | } 22 | }) 23 | } 24 | 25 | if (item.children) { 26 | generateRouteByLang(item.children, lang, routes) 27 | } 28 | } 29 | 30 | return routes 31 | } 32 | 33 | function generateRoutes (items) { 34 | let routes = [] 35 | let langs = Object.keys(locales) 36 | 37 | for (let idx = 0, len = langs.length; idx < len; idx++) { 38 | routes.push(...generateRouteByLang(items, langs[idx])) 39 | } 40 | 41 | return routes 42 | } 43 | 44 | export default new Router({ 45 | mode: 'hash', 46 | linkActiveClass: 'is-active', 47 | scrollBehavior: () => ({ y: 0 }), 48 | routes: [ 49 | { 50 | name: 'Home-zh-CN', 51 | path: '/home', 52 | component: loadView('Home') 53 | }, 54 | { 55 | name: 'Demo-zh-CN', 56 | path: '/demo', 57 | component: loadView('Demo') 58 | }, 59 | { 60 | name: 'Manual-zh-CN', 61 | path: '/manual', 62 | component: loadView('Manual'), 63 | 64 | children: generateRoutes(manual) 65 | }, 66 | { 67 | path: '*', 68 | redirect: '/home' 69 | } 70 | ] 71 | }) 72 | -------------------------------------------------------------------------------- /src/router/manual.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'Install' 4 | }, 5 | { 6 | name: 'Basic', 7 | lableOnly: true, 8 | expanded: false, 9 | 10 | children: [ 11 | { 12 | name: 'Button', 13 | icon: 'fa-laptop' 14 | }, 15 | { 16 | name: 'Icon', 17 | icon: 'fa-leaf' 18 | } 19 | ] 20 | }, 21 | { 22 | name: 'Interact', 23 | lableOnly: true, 24 | expanded: false, 25 | 26 | children: [ 27 | { 28 | name: 'Collapse', 29 | icon: 'fa-window-maximize' 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- 1 | import * as types from './mutation-types' 2 | 3 | export const toggleSidebar = ({ commit }, opened) => commit(types.TOGGLE_SIDEBAR, opened) 4 | 5 | export const togglePage = ({ commit }, pageName) => commit(types.TOGGLE_PAGE, pageName) 6 | 7 | export const toggleDevice = ({ commit }, device) => commit(types.TOGGLE_DEVICE, device) 8 | 9 | export const switchEffect = ({ commit }, effectItem) => { 10 | if (effectItem) { 11 | commit(types.SWITCH_EFFECT, effectItem) 12 | } 13 | } 14 | 15 | export const toggleLang = ({ commit }, lang) => commit(types.TOGGLE_LANG, lang) 16 | -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | const app = state => state.app 2 | const device = state => state.app.device 3 | const sidebar = state => state.app.sidebar 4 | const effect = state => state.app.effect 5 | const current = state => state.app.current 6 | 7 | export { 8 | app, 9 | device, 10 | sidebar, 11 | effect, 12 | current 13 | } 14 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import * as actions from './actions' 4 | import * as getters from './getters' 5 | 6 | import app from './modules/app' 7 | 8 | Vue.use(Vuex) 9 | 10 | const store = new Vuex.Store({ 11 | strict: true, // process.env.NODE_ENV !== 'production', 12 | actions, 13 | getters, 14 | modules: { 15 | app 16 | }, 17 | state: { 18 | }, 19 | mutations: { 20 | } 21 | }) 22 | 23 | export default store 24 | -------------------------------------------------------------------------------- /src/store/modules/app.js: -------------------------------------------------------------------------------- 1 | import * as types from '../mutation-types' 2 | import router from 'src/router' 3 | 4 | const state = { 5 | current: { 6 | page: '', 7 | lang: 'zh-CN' 8 | }, 9 | device: { 10 | isMobile: false, 11 | isTablet: false 12 | }, 13 | sidebar: { 14 | opened: false, 15 | hidden: false 16 | }, 17 | effect: { 18 | translate3d: true 19 | } 20 | } 21 | 22 | const mutations = { 23 | [types.TOGGLE_DEVICE] (state, device) { 24 | state.device.isMobile = device === 'mobile' 25 | state.device.isTablet = device === 'tablet' 26 | }, 27 | 28 | [types.TOGGLE_PAGE] (state, pageName) { 29 | state.current.page = pageName 30 | }, 31 | 32 | [types.TOGGLE_SIDEBAR] (state, opened) { 33 | if (state.device.isMobile) { 34 | state.sidebar.opened = opened 35 | } else { 36 | state.sidebar.opened = true 37 | } 38 | }, 39 | 40 | [types.SWITCH_EFFECT] (state, effectItem) { 41 | for (let name in effectItem) { 42 | state.effect[name] = effectItem[name] 43 | } 44 | }, 45 | 46 | [types.TOGGLE_LANG] (state, lang) { 47 | if (state.current.lang === lang) return 48 | 49 | router.push(router.currentRoute.path.replace(state.current.lang, lang)) 50 | state.current.lang = lang 51 | } 52 | 53 | } 54 | 55 | export default { 56 | state, 57 | mutations 58 | } 59 | -------------------------------------------------------------------------------- /src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | export const TOGGLE_DEVICE = 'TOGGLE_DEVICE' 2 | 3 | export const TOGGLE_PAGE = 'TOGGLE_PAGE' 4 | 5 | export const TOGGLE_SIDEBAR = 'TOGGLE_SIDEBAR' 6 | 7 | export const CHANGE_MENU_LABEL = 'CHANGE_MENU_LABEL' 8 | 9 | export const SWITCH_EFFECT = 'SWITCH_EFFECT' 10 | 11 | export const TOGGLE_LANG = 'TOGGLE_LANG' 12 | -------------------------------------------------------------------------------- /src/styles/api-table.css: -------------------------------------------------------------------------------- 1 | .manual-content > table { 2 | border-collapse: collapse; 3 | border-spacing: 0; 4 | empty-cells: show; 5 | border: 1px solid #e9e9e9; 6 | width: 100%; 7 | margin-bottom: 2rem; 8 | box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); 9 | } 10 | 11 | .manual-content > table td, 12 | .manual-content > table th { 13 | border: 1px solid #e9e9e9; 14 | padding: 8px 16px; 15 | text-align: left; 16 | } 17 | 18 | .manual-content > table > thead th{ 19 | background-color: #f1e6f5; 20 | } -------------------------------------------------------------------------------- /src/styles/code-md.css: -------------------------------------------------------------------------------- 1 | .hljs { 2 | display: block; 3 | overflow-x: auto; 4 | padding: 0.5em; 5 | background: #2b2b2b; 6 | } 7 | 8 | .hljs { 9 | color: #bababa; 10 | } 11 | 12 | .hljs-strong, 13 | .hljs-emphasis { 14 | color: #a8a8a2; 15 | } 16 | 17 | .hljs-bullet, 18 | .hljs-quote, 19 | .hljs-link, 20 | .hljs-number, 21 | .hljs-regexp, 22 | .hljs-literal { 23 | color: #6896ba; 24 | } 25 | 26 | .hljs-code, 27 | .hljs-selector-class { 28 | color: #a6e22e; 29 | } 30 | 31 | .hljs-emphasis { 32 | font-style: italic; 33 | } 34 | 35 | .hljs-keyword, 36 | .hljs-selector-tag, 37 | .hljs-section, 38 | .hljs-attribute, 39 | .hljs-name, 40 | .hljs-variable { 41 | color: #268bd2; 42 | } 43 | 44 | .hljs-params { 45 | color: #b9b9b9; 46 | } 47 | 48 | .hljs-attr { 49 | color: #B58900; 50 | } 51 | 52 | .hljs-string { 53 | color: #2aa198; 54 | } 55 | 56 | .hljs-subst, 57 | .hljs-type, 58 | .hljs-built_in, 59 | .hljs-builtin-name, 60 | .hljs-symbol, 61 | .hljs-selector-id, 62 | .hljs-selector-attr, 63 | .hljs-selector-pseudo, 64 | .hljs-template-tag, 65 | .hljs-template-variable, 66 | .hljs-addition { 67 | color: #e0c46c; 68 | } 69 | 70 | .hljs-comment, 71 | .hljs-deletion, 72 | .hljs-meta { 73 | color: #7f7f7f; 74 | } -------------------------------------------------------------------------------- /src/utils/anchor.js: -------------------------------------------------------------------------------- 1 | export default { 2 | adjust () { 3 | const anchors = document.querySelectorAll('.header-anchor') 4 | const basePath = window.location.href 5 | 6 | anchors.forEach((a) => { 7 | a.href = basePath + a.getAttribute('href') 8 | }) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/utils/lazyLoading.js: -------------------------------------------------------------------------------- 1 | // lazy loading Components 2 | // https://github.com/vuejs/vue-router/blob/dev/examples/lazy-loading/app.js#L8 3 | const loadView = (name, index = false) => () => import(`views/${name}${index ? '/index' : ''}.vue`) 4 | const loadDoc = (name, lang) => () => import(`docs/${lang}/${name}.md`) 5 | export { loadView, loadDoc } 6 | -------------------------------------------------------------------------------- /src/views/Demo.vue: -------------------------------------------------------------------------------- 1 | 86 | 87 | 91 | 92 | 102 | -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 49 | 50 | 86 | -------------------------------------------------------------------------------- /src/views/Manual.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 52 | 53 | 75 | 76 | 106 | --------------------------------------------------------------------------------