├── static └── .gitkeep ├── test ├── unit │ ├── specs │ │ ├── Mockjs.spec.js │ │ ├── Router.spec.js │ │ └── Hello.spec.js │ ├── .eslintrc │ ├── index.js │ └── karma.conf.js └── e2e │ ├── reports │ └── CHROME_53.0.2785.143_LINUX_test.xml │ ├── specs │ └── test.js │ ├── custom-assertions │ └── elementCount.js │ ├── runner.js │ └── nightwatch.conf.js ├── .bowerrc ├── src ├── assets │ ├── test.js │ ├── logo.png │ ├── limi │ │ ├── bg.gif │ │ ├── dot.gif │ │ ├── logo.png │ │ ├── banner.jpg │ │ ├── clouds.gif │ │ ├── title.jpg │ │ └── articleBanner.jpg │ ├── navigate.png │ └── layout3 │ │ ├── banner.jpg │ │ ├── pic01.jpg │ │ ├── pic02.jpg │ │ └── pic03.jpg ├── components │ ├── limi │ │ ├── item.toml │ │ ├── banner.vue │ │ ├── footer.vue │ │ ├── content.vue │ │ ├── Nav.vue │ │ ├── header.styl │ │ └── header.vue │ ├── page │ │ ├── shareData.js │ │ ├── footer.vue │ │ ├── banner.vue │ │ ├── child.vue │ │ ├── header.vue │ │ └── content.vue │ ├── shop │ │ ├── index.vue │ │ ├── product-list.vue │ │ └── cart.vue │ ├── w3 │ │ ├── shadow.vue │ │ └── bgclip.vue │ ├── layout4 │ │ ├── button.vue │ │ └── green.vue │ ├── nav │ │ ├── menus.vue │ │ ├── menus.styl │ │ ├── list.styl.bak │ │ └── list.vue │ ├── index.js │ ├── flex │ │ └── second.vue │ └── Hello.vue ├── api │ ├── urls.js │ ├── mock │ │ ├── index.js │ │ ├── mock.shop.js │ │ └── mock.nav.js │ └── shop.js ├── views │ ├── template.vue │ ├── mind │ │ ├── mind_1.vue │ │ ├── linear_gradient.vue │ │ ├── index.vue │ │ ├── shadow.vue │ │ └── girl.vue │ ├── vuex.vue │ ├── layout │ │ ├── index.vue │ │ ├── layout1.vue │ │ ├── layout2.vue │ │ ├── layout4.vue │ │ └── layout3.vue │ ├── flex.vue │ ├── vue.vue │ ├── limi.vue │ ├── second.vue │ └── third.vue ├── store │ ├── actions.js │ ├── mutation-types.js │ ├── getters.js │ ├── index.js │ └── modules │ │ ├── products.js │ │ └── cart.js ├── App.vue ├── router │ ├── index.js │ └── router_path.toml ├── main.js ├── currency.js └── styles │ └── common.css ├── config ├── prod.env.js ├── test.env.js ├── dev.env.js └── index.js ├── .editorconfig ├── .babelrc ├── index.html ├── .gitignore ├── README.md ├── LICENSE └── package.json /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/specs/Mockjs.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "static/bower_components" 3 | } -------------------------------------------------------------------------------- /src/assets/test.js: -------------------------------------------------------------------------------- 1 | 2 | console.log('test') 3 | var DEAD = '123' -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /src/components/limi/item.toml: -------------------------------------------------------------------------------- 1 | titles = ['首页', '培训课程', '优秀学员', '课程疑问', '职业规划'] 2 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/limi/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/bg.gif -------------------------------------------------------------------------------- /src/assets/limi/dot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/dot.gif -------------------------------------------------------------------------------- /src/assets/limi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/logo.png -------------------------------------------------------------------------------- /src/assets/navigate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/navigate.png -------------------------------------------------------------------------------- /src/components/limi/banner.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /src/assets/limi/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/banner.jpg -------------------------------------------------------------------------------- /src/assets/limi/clouds.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/clouds.gif -------------------------------------------------------------------------------- /src/assets/limi/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/title.jpg -------------------------------------------------------------------------------- /src/components/page/shareData.js: -------------------------------------------------------------------------------- 1 | 2 | function ShareData () { 3 | this.data = {} 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/assets/layout3/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/layout3/banner.jpg -------------------------------------------------------------------------------- /src/assets/layout3/pic01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/layout3/pic01.jpg -------------------------------------------------------------------------------- /src/assets/layout3/pic02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/layout3/pic02.jpg -------------------------------------------------------------------------------- /src/assets/layout3/pic03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/layout3/pic03.jpg -------------------------------------------------------------------------------- /src/assets/limi/articleBanner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molysama/vue-learn/HEAD/src/assets/limi/articleBanner.jpg -------------------------------------------------------------------------------- /src/components/page/footer.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /src/api/urls.js: -------------------------------------------------------------------------------- 1 | 2 | export const product_all = '/product/all' 3 | export const product_buy = '/product/buy' 4 | export const product_add = '/product/add' 5 | 6 | -------------------------------------------------------------------------------- /src/components/page/banner.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/views/template.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /src/views/mind/mind_1.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | -------------------------------------------------------------------------------- /src/views/vuex.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /src/components/limi/footer.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /src/components/limi/content.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /src/components/shop/index.vue: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | import * as types from './mutation-types' 3 | 4 | export const addToCart = ({ commit }, product) => { 5 | if (product.inventory > 0) { 6 | commit(types.ADD_TO_CART, { 7 | id: product.id 8 | }) 9 | } 10 | } -------------------------------------------------------------------------------- /src/components/limi/Nav.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-3"], 3 | "plugins": ["transform-runtime"], 4 | "comments": false, 5 | "plugins": [["component", [ 6 | { 7 | "libraryName": "element-ui", 8 | "styleLibraryName": "theme-default" 9 | } 10 | ]]] 11 | } 12 | -------------------------------------------------------------------------------- /src/components/w3/shadow.vue: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | -------------------------------------------------------------------------------- /src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | 2 | export const ADD_TO_CART = 'ADD_TO_CART' 3 | export const CHECKOUT_REQUEST = 'CHECKOUT_REQUEST' 4 | export const CHECKOUT_SUCCESS = 'CHECKOUT_SUCCESS' 5 | export const CHECKOUT_FAILURE = 'CHECKOUT_FAILURE' 6 | export const RECEIVE_PRODUCTS = 'RECEIVE_PRODUCTS' -------------------------------------------------------------------------------- /src/views/layout/index.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 18 | 19 | -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | 2 | export const cartProducts = state => { 3 | return state.cart.added.map(({id, quantity}) => { 4 | const product = state.products.all.find(p => p.id === id) 5 | return { 6 | title: product.title, 7 | price: product.price, 8 | quantity 9 | } 10 | }) 11 | } -------------------------------------------------------------------------------- /test/unit/specs/Router.spec.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue' 3 | import VueRouter from 'vue-router' 4 | 5 | import Router from 'src/config/router' 6 | 7 | describe('Router', () => { 8 | 9 | it('Router should not be null or err', () => { 10 | 11 | should.exist(Router) 12 | }) 13 | 14 | }) 15 | -------------------------------------------------------------------------------- /src/views/flex.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | require('flex-css') 11 | 12 | export default { 13 | 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /src/api/mock/index.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs' 2 | 3 | import { nav } from './mock.nav.js' 4 | import { shop } from './mock.shop.js' 5 | 6 | function addToMock(list) { 7 | list.forEach(n => { 8 | Mock.mock(n.path, n.data) 9 | }) 10 | } 11 | 12 | addToMock(nav) 13 | addToMock(shop) 14 | 15 | export default Mock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/views/mind/linear_gradient.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /test/unit/specs/Hello.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Hello from 'src/components/Hello' 3 | 4 | describe('Hello.vue', () => { 5 | it('should render correct contents', () => { 6 | const vm = new Vue({ 7 | el: document.createElement('div'), 8 | render: (h) => h(Hello) 9 | }) 10 | expect(vm.$el.querySelector('.hello h1').textContent) 11 | .to.equal('Welcome to Your Vue.js App') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | vue-learn 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | import * as actions from './actions' 5 | import * as getters from './getters' 6 | 7 | import cart from './modules/cart' 8 | import products from './modules/products' 9 | 10 | Vue.use(Vuex) 11 | 12 | const debug = process.env.NODE_ENV !== 'production' 13 | 14 | export default new Vuex.Store({ 15 | actions, 16 | getters, 17 | modules: { 18 | cart, 19 | products 20 | }, 21 | strict: debug 22 | }) 23 | -------------------------------------------------------------------------------- /src/views/layout/layout1.vue: -------------------------------------------------------------------------------- 1 | 2 | 21 | 30 | -------------------------------------------------------------------------------- /src/components/page/child.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /test/e2e/reports/CHROME_53.0.2785.143_LINUX_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/mind/index.vue: -------------------------------------------------------------------------------- 1 | 10 | 27 | 28 | -------------------------------------------------------------------------------- /src/api/shop.js: -------------------------------------------------------------------------------- 1 | 2 | import axios from 'axios' 3 | 4 | export default { 5 | getProducts (callback) { 6 | 7 | axios.get('/product/all').then(res => { 8 | callback(res.data) 9 | }) 10 | }, 11 | 12 | buyProducts (products, successHandle, errorHandle) { 13 | 14 | axios.post('/product/buy', products) 15 | .then(res => { 16 | if (Math.random() > 0.5) { 17 | successHandle(res) 18 | } else { 19 | errorHandle(res) 20 | } 21 | }) 22 | .catch(error => errorHandle(error)) 23 | } 24 | } -------------------------------------------------------------------------------- /src/api/mock/mock.shop.js: -------------------------------------------------------------------------------- 1 | 2 | import * as API from '../urls' 3 | 4 | const products = [ 5 | {"id": 1, "title": "iPad 4 Mini", "price": 500.01, "inventory": 2}, 6 | {"id": 2, "title": "H&M T-Shirt White", "price": 10.99, "inventory": 10}, 7 | {"id": 3, "title": "Charli XCX - Sucker CD", "price": 19.99, "inventory": 5} 8 | ] 9 | 10 | export const shop = [ 11 | { 12 | path: API.product_all, 13 | data: products 14 | }, 15 | { 16 | path: API.product_buy, 17 | data: 'success' 18 | }, 19 | { 20 | path: API.product_add, 21 | data: [] 22 | } 23 | ] -------------------------------------------------------------------------------- /src/components/layout4/button.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 24 | -------------------------------------------------------------------------------- /src/views/vue.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 28 | 29 | -------------------------------------------------------------------------------- /src/components/nav/menus.vue: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 23 | 24 | -------------------------------------------------------------------------------- /test/unit/index.js: -------------------------------------------------------------------------------- 1 | // Polyfill fn.bind() for PhantomJS 2 | /* eslint-disable no-extend-native */ 3 | Function.prototype.bind = require('function-bind') 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /src/components/shop/product-list.vue: -------------------------------------------------------------------------------- 1 | 2 | 10 | 29 | -------------------------------------------------------------------------------- /test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementCount('img', 1) 15 | // .assert.elementPresent('.hello') 16 | // .assert.containsText('h1', 'Welcome to Your Vue.js App') 17 | // .assert.elementCount('img', 1) 18 | .end() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | 2 | // 动态注册compontents内的所有组件,之后在全局无需注册即可使用 3 | // 格式为 目录名-文件名, 首字母大写 4 | // 例子1 src/components/page/header.vue, 5 | // 例子2 src/components/Hello.vue, 6 | 7 | import Vue from 'vue' 8 | const requireContext = require.context('components', true, /.*\.vue$/) 9 | 10 | const components = requireContext.keys().map(key => { 11 | Vue.component(rename(key), requireContext(key)) 12 | }) 13 | 14 | /* 将组件注册成 目录-文件名的形式, 首字母大写 如 Page-header 15 | * 无目录则为文件名,首字母大写,如 Hello 16 | */ 17 | function rename (key) { 18 | let name = key.replace(/\.+\//, "").replace(/\.vue/, "").replace(/\//, "-").replace(/^(\w)/, v => v.toUpperCase()) 19 | return name 20 | } 21 | 22 | module.exports = components 23 | -------------------------------------------------------------------------------- /src/views/limi.vue: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 20 | 21 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import _ from 'lodash/object' 4 | 5 | // 载入路由表配置 6 | import { navs } from './router_path.toml' 7 | 8 | Vue.use(VueRouter) 9 | 10 | const routes = navs.map(createRoute) 11 | 12 | // 编译路由 13 | function createRoute(route) { 14 | 15 | const result = _.pick(route, ['name', 'path', 'alias', 'redirect', 'meta']) 16 | result.component = resolve => require(['../views/' + route.router], resolve) 17 | 18 | // 如果存在子路由 19 | if (route.child) { 20 | result.children = route.child.map(createRoute) 21 | } 22 | 23 | return result 24 | } 25 | 26 | //实例化路由组件 27 | const router = new VueRouter({ 28 | // mode: 'history', 29 | routes 30 | }) 31 | module.exports = router 32 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | 6 | //添加mockjs拦截请求,模拟返回服务器数据 7 | import mock from './api/mock' 8 | 9 | // element-ui 10 | import { Button, col, row } from 'element-ui' 11 | Vue.use(Button) 12 | Vue.use(col) 13 | Vue.use(row) 14 | 15 | // vuex 16 | import store from './store' 17 | import { currency } from './currency' 18 | Vue.filter('currency', currency) 19 | 20 | import components from './components' 21 | import router from './router' 22 | 23 | // 创建根实例 24 | new Vue({ 25 | el: '#app', 26 | template: '', 27 | components: { App }, 28 | router, 29 | store 30 | }) 31 | -------------------------------------------------------------------------------- /src/store/modules/products.js: -------------------------------------------------------------------------------- 1 | 2 | import shop from '../../api/shop.js' 3 | import * as types from '../mutation-types' 4 | 5 | const state = { 6 | all: [] 7 | } 8 | 9 | const getters = { 10 | allProducts: state => state.all 11 | } 12 | 13 | const actions = { 14 | getAllProducts ({ commit }) { 15 | shop.getProducts(products => { 16 | commit(types.RECEIVE_PRODUCTS, { products }) 17 | }) 18 | } 19 | } 20 | 21 | const mutations = { 22 | [types.RECEIVE_PRODUCTS] (state, { products }) { 23 | state.all = products 24 | }, 25 | 26 | [types.ADD_TO_CART] (state, { id }) { 27 | state.all.find(p => p.id === id).inventory-- 28 | } 29 | 30 | } 31 | 32 | export default { 33 | state, 34 | getters, 35 | actions, 36 | mutations 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/components/w3/bgclip.vue: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 21 | 22 | -------------------------------------------------------------------------------- /src/api/mock/mock.nav.js: -------------------------------------------------------------------------------- 1 | 2 | export const nav = [ 3 | { 4 | path: '/user', 5 | data: { 6 | "array|1-3": [ 7 | { 8 | "name|+1": [ 9 | "hello", "vue", "world" 10 | ] 11 | } 12 | ] 13 | } 14 | }, 15 | { 16 | path: '/pm25', 17 | data: { 18 | "object|2-4": { 19 | "110000": "北京市", 20 | "120000": "天津市", 21 | "130000": "河北省", 22 | "140000": "山西省" 23 | } 24 | 25 | } 26 | }, 27 | { 28 | path: '/loadParentData', 29 | data: { 30 | "name": 'lgqlee', 31 | "result": [5, 34, 767, 9] 32 | } 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /src/currency.js: -------------------------------------------------------------------------------- 1 | 2 | const digitsRE = /(\d{3})(?=\d)/g 3 | 4 | export function currency (value, currency, decimals) { 5 | value = parseFloat(value) 6 | if (!isFinite(value) || (!value && value !== 0)) return '' 7 | currency = currency != null ? currency : '$' 8 | decimals = decimals != null ? decimals : 2 9 | var stringified = Math.abs(value).toFixed(decimals) 10 | var _int = decimals 11 | ? stringified.slice(0, -1 - decimals) 12 | : stringified 13 | var i = _int.length % 3 14 | var head = i > 0 15 | ? (_int.slice(0, i) + (_int.length > 3 ? ',' : '')) 16 | : '' 17 | var _float = decimals 18 | ? stringified.slice(-1 - decimals) 19 | : '' 20 | var sign = value < 0 ? '-' : '' 21 | return sign + currency + head + 22 | _int.slice(i).replace(digitsRE, '$1,') + 23 | _float 24 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # build files 34 | dist 35 | 36 | # Optional npm cache directory 37 | .npm 38 | 39 | # Optional REPL history 40 | .node_repl_history 41 | 42 | # vscode files 43 | .vscode 44 | 45 | # github blog 46 | github 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-learn 2 | 3 | ```bash 4 | # 建议使用淘宝源 5 | $ npm install cnpm -g 6 | $ cnpm install 7 | 8 | ``` 9 | 10 | ``` 11 | 12 | src/ 13 | ├── App.vue ----------------------- 入口组件 14 | ├── assets ----------------------- 静态资源 15 | | 16 | ├── api -------------------------- 管理http请求 17 | │   18 | ├── components -------------------- vue组件 19 | │   20 | ├── router ------------------------ 配置目录 21 | │   ├── index.js ------------------ 动态加载路由 22 | │   └── router_path.toml ---------- 路由配置文件 23 | | 24 | ├── store ------------------------- vuex 25 | ├── views ------------------------- 视图模板 26 | ├── styles ------------------------ 主样式 27 | ├── main.js ----------------------- 入口JS 28 | │   29 | 30 | ``` 31 | 32 | ## Features 33 | * vue 34 | * vuex 35 | * vue-router 36 | * stylus 37 | * pug 38 | * axios 39 | * mockjs 40 | * element-UI 41 | 42 | ## License 43 | Mit 44 | -------------------------------------------------------------------------------- /src/styles/common.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Armata', Arial, Helvetica, sans-serif; 3 | font-size: 16px; 4 | line-height: 25px; 5 | background: #E36A5B; 6 | /*max-width: 960px;*/ 7 | margin: 0 auto; 8 | } 9 | ol, ul, li { 10 | margin: 0; 11 | padding: 0; 12 | border: 0; 13 | font-size: 100%; 14 | font: inherit; 15 | vertical-align: baseline; 16 | list-style: none; 17 | } 18 | p 19 | { 20 | font-size: 1em; 21 | margin-top: 0px; 22 | margin-bottom: 20px; 23 | line-height: 25px; 24 | letter-spacing: -0.02em; 25 | } 26 | a, 27 | a:visited, 28 | a:hover, 29 | a:active 30 | { 31 | color: black; 32 | text-decoration: none; 33 | border: none; 34 | outline: none; 35 | } 36 | /* 清除浮动 */ 37 | .clearfix:after{ 38 | content: ''; 39 | display: block; 40 | clear: both; 41 | height: 0; 42 | visibility: hidden; 43 | } 44 | .clearfix{ /*兼容 IE*/ 45 | zoom: 1; 46 | } 47 | -------------------------------------------------------------------------------- /src/components/limi/header.styl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | .logo 5 | width 220px 6 | height 54px 7 | float left 8 | background #991616 9 | 10 | a 11 | display block 12 | 13 | img 14 | display block 15 | 16 | .nav 17 | width 780px 18 | height 54px 19 | float left 20 | background #393838 21 | list-style none 22 | position relative 23 | 24 | li 25 | float left 26 | 27 | a 28 | cursor pointer 29 | position relative 30 | box-sizing border-box 31 | border-bottom 4px solid transparent 32 | display block 33 | width 86px 34 | height 54px 35 | line-height 54px 36 | text-align center 37 | font-size 12px 38 | color #ccc 39 | text-decoration none 40 | &:hover 41 | color #fff 42 | 43 | &.active 44 | a 45 | border-bottom 4px solid deepskyblue 46 | color #fff 47 | -------------------------------------------------------------------------------- /test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/components/page/header.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 39 | -------------------------------------------------------------------------------- /src/components/shop/cart.vue: -------------------------------------------------------------------------------- 1 | 2 | 17 | 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 lgqlee 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 | -------------------------------------------------------------------------------- /test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | // 2. run the nightwatch test suite against it 6 | // to run in additional browsers: 7 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 8 | // 2. add it to the --env flag below 9 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 10 | // For more information on Nightwatch's config file, see 11 | // http://nightwatchjs.org/guide#settings-file 12 | var opts = process.argv.slice(2) 13 | if (opts.indexOf('--config') === -1) { 14 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 15 | } 16 | if (opts.indexOf('--env') === -1) { 17 | opts = opts.concat(['--env', 'chrome']) 18 | } 19 | 20 | var spawn = require('cross-spawn') 21 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 22 | 23 | runner.on('exit', function (code) { 24 | server.close() 25 | process.exit(code) 26 | }) 27 | 28 | runner.on('error', function (err) { 29 | server.close() 30 | throw err 31 | }) 32 | -------------------------------------------------------------------------------- /src/views/second.vue: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | -------------------------------------------------------------------------------- /src/components/flex/second.vue: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'] 18 | 19 | }, 20 | dev: { 21 | env: require('./dev.env'), 22 | port: 8080, 23 | assetsSubDirectory: 'static', 24 | assetsPublicPath: '/', 25 | proxyTable: {}, 26 | // CSS Sourcemaps off by default because relative paths are "buggy" 27 | // with this option, according to the CSS-Loader README 28 | // (https://github.com/webpack/css-loader#sourcemaps) 29 | // In our experience, they generally work as expected, 30 | // just be aware of this issue when enabling this option. 31 | cssSourceMap: false 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/guide#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar', 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/components/limi/header.vue: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 59 | 60 | -------------------------------------------------------------------------------- /src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | 35 | 54 | -------------------------------------------------------------------------------- /src/views/layout/layout2.vue: -------------------------------------------------------------------------------- 1 | 36 | 57 | -------------------------------------------------------------------------------- /src/views/third.vue: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 24 | 25 | -------------------------------------------------------------------------------- /src/components/page/content.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 63 | -------------------------------------------------------------------------------- /src/store/modules/cart.js: -------------------------------------------------------------------------------- 1 | 2 | import shop from '../../api/shop.js' 3 | import * as types from '../mutation-types' 4 | 5 | const state = { 6 | added: [], 7 | checkoutStatus: null 8 | } 9 | 10 | const getters = { 11 | checkoutStatus: state => state.checkoutStatus 12 | } 13 | 14 | const actions = { 15 | checkout ({commit, state}, products) { 16 | 17 | // 对象扩展,将state.added属性拷贝给savedCartItems 18 | const savedCartItems = [...state.added] 19 | 20 | commit(types.CHECKOUT_REQUEST) 21 | shop.buyProducts( 22 | products, 23 | () => commit(types.CHECKOUT_SUCCESS), 24 | () => commit(types.CHECKOUT_FAILURE, { savedCartItems }) 25 | ) 26 | } 27 | } 28 | 29 | // mutations负责修改state 30 | const mutations = { 31 | 32 | // mutation: 添加到购物车 33 | [types.ADD_TO_CART] (state, { id }) { 34 | state.lastCheckout = null 35 | 36 | /** 37 | * 匹配购物车中的该商品id 不存在就添加到购物车 存在的话+1 38 | */ 39 | const record = state.added.find(p => p.id === id) 40 | if (!record) { 41 | state.added.push({ 42 | id, 43 | quantity: 1 44 | }) 45 | } else { 46 | record.quantity++ 47 | } 48 | }, 49 | 50 | // 51 | [types.CHECKOUT_REQUEST] (state) { 52 | 53 | state.added = [] 54 | state.checkoutStatus = null 55 | }, 56 | 57 | //mutation: 确认成功 58 | [types.CHECKOUT_SUCCESS] (state) { 59 | 60 | state.checkoutStatus = 'successful' 61 | }, 62 | 63 | //mutation: 确认失败 64 | [types.CHECKOUT_FAILURE] (state, { savedCartItems }) { 65 | 66 | state.added = savedCartItems 67 | state.checkoutStatus = 'failed' 68 | } 69 | 70 | } 71 | 72 | export default { 73 | state, 74 | getters, 75 | actions, 76 | mutations 77 | } -------------------------------------------------------------------------------- /src/components/layout4/green.vue: -------------------------------------------------------------------------------- 1 | 2 | 15 | 67 | 84 | -------------------------------------------------------------------------------- /src/views/mind/shadow.vue: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | 37 | 38 | -------------------------------------------------------------------------------- /src/router/router_path.toml: -------------------------------------------------------------------------------- 1 | 2 | # 数据格式: 3 | # { 4 | # "navs": [{ 5 | # name, 路由命名 6 | # title, 导航标题 7 | # path, 导航链接 8 | # router, 模板路径 9 | # alias, 别名 10 | # redirect, 重定向(简洁使用,仅接受name) 11 | # }, 12 | # ... 13 | # ] 14 | # } 15 | 16 | 17 | # ROUTER_PATH = '../views/' 18 | 19 | [[navs]] 20 | name = "vue" 21 | title = "Vue示例" 22 | path = "/vue" 23 | router = "vue" 24 | 25 | [[navs]] 26 | name = "layout" 27 | title = "Layout" 28 | path = "/layout" 29 | router = "layout/index" 30 | [navs.redirect] 31 | name = "layout1" 32 | [[navs.child]] 33 | name = "layout1" 34 | title = "第一个布局" 35 | path = "layout1" 36 | router = "layout/layout1" 37 | [[navs.child]] 38 | name = "layout2" 39 | title = "第二个布局" 40 | path = "layout2" 41 | router = "layout/layout2" 42 | [[navs.child]] 43 | name = "layout3" 44 | title = "第三个布局" 45 | path = "layout3" 46 | router = "layout/layout3" 47 | [[navs.child]] 48 | name = "layout4" 49 | title = "第四个布局" 50 | path = "layout4" 51 | router = "layout/layout4" 52 | 53 | [[navs]] 54 | name = "flex" 55 | title = "FLEX" 56 | path = "/flex" 57 | router = "third" 58 | 59 | [[navs]] 60 | name = "limi" 61 | title = "厘米例子" 62 | path = "/limi" 63 | router = "limi" 64 | 65 | 66 | [[navs]] 67 | name = "mind" 68 | title = "MIND" 69 | path = "/mind" 70 | router = "mind/index" 71 | alias = "/" 72 | [navs.redirect] 73 | name = "mind1" 74 | [[navs.child]] 75 | name = "mind1" 76 | title = "日历" 77 | path = "mind1" 78 | router = "mind/mind_1" 79 | [[navs.child]] 80 | name = "shadow" 81 | title = "多重投影" 82 | path = "shadow" 83 | router = "mind/shadow" 84 | [[navs.child]] 85 | name = "girl" 86 | title = "GIRL" 87 | path = "girl" 88 | router = "mind/girl" 89 | [[navs.child]] 90 | name = "linear_gradient" 91 | title = "条纹" 92 | path = "linear-gradient" 93 | router = "mind/linear_gradient" 94 | [[navs.child]] 95 | name = "vuex" 96 | title = "VUEX" 97 | path = "VUEX" 98 | router = "vuex" 99 | -------------------------------------------------------------------------------- /src/components/nav/menus.styl: -------------------------------------------------------------------------------- 1 | 2 | width = 150px 3 | height = 46px 4 | arrowSize = 5px 5 | aWidth = width*0.8 6 | 7 | // 主菜单 8 | ul 9 | margin 0 10 | padding 0 11 | list-style none 12 | &:first-child 13 | transition-duration .5s 14 | opacity 0.2 15 | &:hover 16 | opacity 1 17 | //TODO: 非hover时隐藏左侧导航栏 18 | // position relative 19 | // left -109px 20 | // i 21 | // position absolute 22 | // left 120px 23 | // &:hover 24 | // left 0px 25 | // i 26 | // position relative 27 | // left 0 28 | 29 | li 30 | &:first-child 31 | border-top-right-radius 3px 32 | a 33 | padding-top 13px 34 | &:last-child 35 | border-bottom-right-radius 3px 36 | a 37 | padding-bottom 13px 38 | 39 | 40 | 41 | li 42 | // position relative 43 | background #efefef 44 | &:hover 45 | background #fff 46 | >ul 47 | display block 48 | ul // 子菜单 49 | width width 50 | padding-left 10px 51 | display none 52 | position absolute 53 | margin -1*height 0 0 width 54 | // top 0 55 | // left 100% 56 | li 57 | &:first-child 58 | border-top-left-radius 3px 59 | border-right-color #efefef 60 | &:before // 小箭头 61 | color #efefef 62 | position absolute 63 | content "" 64 | width 0 65 | height 0 66 | margin 0.5*height 0 0 -1*arrowSize 67 | border-top arrowSize solid transparent 68 | border-bottom arrowSize solid transparent 69 | border-right:arrowSize solid @color 70 | border-right-color inherit 71 | &:last-child 72 | border-bottom-left-radius 3px 73 | 74 | &:hover 75 | border-right-color #fff 76 | a 77 | display inline-block 78 | width aWidth 79 | padding 8px 15px 80 | cursor pointer 81 | color #483430 82 | text-decoration none 83 | //TODO: 设置图标变色过渡时间 transition-delay 0.5s 84 | &:hover, &.router-link-active 85 | i 86 | color deepskyblue 87 | .menu-item 88 | padding-left 5px 89 | padding-right 5px -------------------------------------------------------------------------------- /test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var path = require('path') 7 | var merge = require('webpack-merge') 8 | var baseConfig = require('../../build/webpack.base.conf') 9 | var utils = require('../../build/utils') 10 | var webpack = require('webpack') 11 | var projectRoot = path.resolve(__dirname, '../../') 12 | 13 | var webpackConfig = merge(baseConfig, { 14 | // use inline sourcemap for karma-sourcemap-loader 15 | module: { 16 | loaders: utils.styleLoaders() 17 | }, 18 | devtool: '#inline-source-map', 19 | vue: { 20 | loaders: { 21 | js: 'isparta' 22 | } 23 | }, 24 | plugins: [ 25 | new webpack.DefinePlugin({ 26 | 'process.env': require('../../config/test.env') 27 | }) 28 | ] 29 | }) 30 | 31 | // no need for app entry during tests 32 | delete webpackConfig.entry 33 | 34 | // make sure isparta loader is applied before eslint 35 | webpackConfig.module.preLoaders = webpackConfig.module.preLoaders || [] 36 | webpackConfig.module.preLoaders.unshift({ 37 | test: /\.js$/, 38 | loader: 'isparta', 39 | include: path.resolve(projectRoot, 'src') 40 | }) 41 | 42 | // only apply babel for test files when using isparta 43 | webpackConfig.module.loaders.some(function (loader, i) { 44 | if (loader.loader === 'babel') { 45 | loader.include = path.resolve(projectRoot, 'test/unit') 46 | return true 47 | } 48 | }) 49 | 50 | module.exports = function (config) { 51 | config.set({ 52 | // to run in additional browsers: 53 | // 1. install corresponding karma launcher 54 | // http://karma-runner.github.io/0.13/config/browsers.html 55 | // 2. add it to the `browsers` array below. 56 | browsers: ['PhantomJS'], 57 | frameworks: ['mocha', 'sinon-chai'], 58 | reporters: ['spec', 'coverage'], 59 | files: ['./index.js'], 60 | preprocessors: { 61 | './index.js': ['webpack', 'sourcemap'] 62 | }, 63 | webpack: webpackConfig, 64 | webpackMiddleware: { 65 | noInfo: true 66 | }, 67 | coverageReporter: { 68 | dir: './coverage', 69 | reporters: [ 70 | { type: 'lcov', subdir: '.' }, 71 | { type: 'text-summary' } 72 | ] 73 | } 74 | }) 75 | } 76 | -------------------------------------------------------------------------------- /src/components/nav/list.styl.bak: -------------------------------------------------------------------------------- 1 | 2 | @import url(http://weloveiconfonts.com/api/?family=entypo); 3 | 4 | /* entypo */ 5 | [class*="entypo-"]:before { 6 | display: inline-block; 7 | width: 20px; 8 | height: 20px; 9 | margin-right: 10px; 10 | text-align: center; 11 | font-family: 'entypo', sans-serif; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | body { 18 | color: #483430; 19 | background: #E36A5B; 20 | } 21 | .side-panel { 22 | padding: 30px 0; 23 | 24 | &:nth-child(2n) { 25 | background: #483430; 26 | } 27 | 28 | ul { 29 | margin: 0; 30 | padding: 0; 31 | list-style: none; 32 | } 33 | > ul { 34 | 35 | > li { 36 | &:first-child { 37 | border-top-right-radius: 3px; 38 | 39 | a { 40 | padding-top: 13px; 41 | } 42 | } 43 | &:last-child { 44 | border-bottom-right-radius: 3px; 45 | a { 46 | padding-bottom: 13px; 47 | } 48 | } 49 | } 50 | ul { 51 | width: 150px; 52 | padding-left: 10px; 53 | display: none; 54 | position: absolute; 55 | top: 0; 56 | left: 100%; 57 | 58 | li { 59 | &:first-child { 60 | border-top-left-radius: 3px; 61 | border-top-right-radius: 3px; 62 | border-right-color: #efefef; 63 | 64 | &:before { 65 | size = 5px; 66 | color: #efefef; 67 | position: absolute; 68 | content: ""; 69 | width: 0; 70 | height: 0; 71 | top: 50%; 72 | right: 100%; 73 | margin-top: size * -1; 74 | border-top: size solid transparent; 75 | border-bottom: size solid transparent; 76 | border-right:size solid @color; 77 | border-right-color: inherit; 78 | } 79 | 80 | &:hover { 81 | border-right-color: #fff; 82 | } 83 | } 84 | &:last-child { 85 | border-bottom-left-radius: 3px; 86 | border-bottom-right-radius: 3px; 87 | } 88 | } 89 | } 90 | } 91 | li { 92 | position: relative; 93 | background: #efefef; 94 | 95 | &:hover { 96 | background: #fff; 97 | 98 | > ul { 99 | display: block; 100 | } 101 | } 102 | } 103 | a { 104 | display: inline-block; 105 | padding: 8px 15px; 106 | cursor: pointer; 107 | } 108 | } -------------------------------------------------------------------------------- /src/components/nav/list.vue: -------------------------------------------------------------------------------- 1 | 2 | 9 | 102 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-learn", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "lgqlee ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "build": "node build/build.js", 10 | "unit": "karma start test/unit/karma.conf.js --single-run", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "debug": "node --nolazy --debug-brk=5858 build/dev-server.js" 14 | }, 15 | "dependencies": { 16 | "axios": "^0.15.3", 17 | "element-ui": "^1.1.6", 18 | "flex-css": "^0.4.1", 19 | "lodash": "^4.17.4", 20 | "mockjs": "^1.0.1-beta3", 21 | "pug": "^2.0.0-beta6", 22 | "stylus": "^0.54.5", 23 | "toml": "^2.3.1", 24 | "toml-loader": "^1.0.0", 25 | "vue": "^2.1.10", 26 | "vue-router": "^2.2.0", 27 | "vue-template-compiler": "^2.1.10", 28 | "vuex": "^2.1.2" 29 | }, 30 | "devDependencies": { 31 | "autoprefixer": "^6.4.0", 32 | "babel-core": "^6.0.0", 33 | "babel-loader": "^6.0.0", 34 | "babel-plugin-component": "^0.9.0", 35 | "babel-plugin-transform-runtime": "^6.0.0", 36 | "babel-preset-es2015": "^6.0.0", 37 | "babel-preset-stage-2": "^6.0.0", 38 | "babel-register": "^6.0.0", 39 | "chai": "^3.5.0", 40 | "chalk": "^1.1.3", 41 | "chromedriver": "^2.21.2", 42 | "connect-history-api-fallback": "^1.1.0", 43 | "cross-spawn": "^4.0.2", 44 | "css-loader": "^0.25.0", 45 | "eventsource-polyfill": "^0.9.6", 46 | "express": "^4.13.3", 47 | "extract-text-webpack-plugin": "^1.0.1", 48 | "file-loader": "^0.9.0", 49 | "function-bind": "^1.0.2", 50 | "html-webpack-plugin": "^2.8.1", 51 | "http-proxy-middleware": "^0.17.2", 52 | "inject-loader": "^2.0.1", 53 | "isparta-loader": "^2.0.0", 54 | "json-loader": "^0.5.4", 55 | "karma": "^1.3.0", 56 | "karma-coverage": "^1.1.1", 57 | "karma-mocha": "^1.2.0", 58 | "karma-phantomjs-launcher": "^1.0.0", 59 | "karma-sinon-chai": "^1.2.0", 60 | "karma-sourcemap-loader": "^0.3.7", 61 | "karma-spec-reporter": "0.0.26", 62 | "karma-webpack": "^1.7.0", 63 | "lolex": "^1.4.0", 64 | "mocha": "^3.1.0", 65 | "nightwatch": "^0.9.8", 66 | "opn": "^4.0.2", 67 | "ora": "^0.3.0", 68 | "phantomjs-prebuilt": "^2.1.3", 69 | "postcss-plugin-px2rem": "^0.6.0", 70 | "selenium-server": "2.53.1", 71 | "semver": "^5.3.0", 72 | "shelljs": "^0.7.4", 73 | "sinon": "^1.17.3", 74 | "sinon-chai": "^2.8.0", 75 | "stylus-loader": "^2.4.0", 76 | "url-loader": "^0.5.7", 77 | "vue-loader": "^10.3.0", 78 | "vue-style-loader": "^1.0.0", 79 | "vue-template-compiler": "^2.1.0", 80 | "webpack": "^1.13.2", 81 | "webpack-dev-middleware": "^1.8.3", 82 | "webpack-hot-middleware": "^2.12.2", 83 | "webpack-merge": "^0.14.1" 84 | }, 85 | "engines": { 86 | "node": ">= 4.0.0", 87 | "npm": ">= 3.0.0" 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/views/layout/layout4.vue: -------------------------------------------------------------------------------- 1 | 2 | 69 | 231 | -------------------------------------------------------------------------------- /src/views/layout/layout3.vue: -------------------------------------------------------------------------------- 1 | 2 | 84 | 253 | -------------------------------------------------------------------------------- /src/views/mind/girl.vue: -------------------------------------------------------------------------------- 1 | 85 | 88 | 89 | --------------------------------------------------------------------------------