├── .gitignore ├── README.MD ├── element-ui-study └── element1.html ├── vue-cli-pro └── Pro │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .postcssrc.js │ ├── README.md │ ├── config │ ├── dev.env.js │ ├── index.js │ ├── prod.env.js │ └── test.env.js │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── main.js │ └── router │ │ └── index.js │ ├── static │ └── .gitkeep │ └── test │ ├── e2e │ ├── custom-assertions │ │ └── elementCount.js │ ├── nightwatch.conf.js │ ├── runner.js │ └── specs │ │ └── test.js │ └── unit │ ├── .eslintrc │ ├── jest.conf.js │ ├── setup.js │ └── specs │ └── HelloWorld.spec.js ├── vue-components ├── component1.html ├── component10.html ├── component11.html ├── component12.html ├── component13.html ├── component14.html ├── component15.html ├── component16.html ├── component2.html ├── component3.html ├── component4.html ├── component5.html ├── component6.html ├── component7.html ├── component8.html ├── component9.html └── test.html ├── vue-demo ├── demo1.html ├── demo2.html ├── demo3.html ├── demo4.html ├── demo5.html ├── demo6.html ├── demo7.html ├── demo7_2.html └── demo8.html ├── vue-router ├── router1.html └── router2.html └── vuex-demo ├── vuex1.html └── vuex2.html /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 50 | 51 | fastlane/report.xml 52 | fastlane/Preview.html 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | ## Vue学习示例 2 | 3 | ### vue-demo部分 4 | 5 | 使用8个demo练习Vue的基础 6 | 7 | 这8个基础的demo分别有 hello world、v-bind 属性绑定、 v-if 的条件渲染、v-for 的列表渲染、 组件component、 动画transition等的简单使用 8 | 9 | 10 | ### vue-components部分 11 | 专门使用示例来描述 Vue 的组件component的具体使用 12 | 13 | ###### component1是一个组件的全局注册的示例。 14 | 15 | ###### component2是一个组件的局部注册的示例。 16 | 17 | ###### component3是一个组件的data表示的正确方式 18 | 19 | ###### component4是一个使用props传递数据的组件示例。 20 | 21 | ###### component5是一个驼峰式命名以及短横线分割式命名在props中的使用示例。 22 | 23 | ###### component6是一个动态props绑定属性的demo。 24 | 25 | ###### component7是一个动态props传递一个对象属性的方法。(能够把对象中的每一项当做属性传递下去) 26 | 27 | ###### component8是一个props验证的示例 28 | 29 | ###### component9是一个非props特性的示例,父组件的class覆盖、合并子组件的class 30 | 31 | ###### component10是一个自定义事件的示例,子组件向父组件传值。 32 | 33 | ###### component11是一个父元素和子元素(通过.sync)双向绑定的示例。 34 | 35 | ###### component12是一个v-model的本质演示。(v-model的本质是v-bind和v-on的语法糖)。 36 | 37 | ###### component13 38 | 39 | ###### component14是一个组件通信的示例,两个非父子组件相互之间通信。 40 | 41 | ###### component15是一个组件使用插槽分发内容的示例 42 | 43 | 44 | ### vue-router部分 45 | 46 | 专门使用一个个的 vue-router 的实例来讲解路由 47 | 48 | ###### router1,一个最简单的路由示例 49 | 50 | ###### router2, 51 | 52 | 53 | ### vuex部分 54 | 55 | 这个是专门学习vuex数据管理的demo 56 | 57 | ###### vuex1,一个最简单的vuex示例 58 | 59 | ### ElementUi部分 60 | 61 | ###### element1,一个简单的element-ui的使用示例 62 | 63 | ### vue-cli-pro 64 | 这是一个专门使用vue的脚手架搭建的项目 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /element-ui-study/element1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | element-ui 6 | 7 | 8 | 9 |
10 | 按钮 11 | 12 |

欢迎使用 Element

13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 28 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.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 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | rules: { 20 | // allow async-await 21 | 'generator-star-spacing': 'off', 22 | // allow debugger during development 23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/README.md: -------------------------------------------------------------------------------- 1 | # pro 2 | 3 | > A Vue.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | 20 | # run unit tests 21 | npm run unit 22 | 23 | # run e2e tests 24 | npm run e2e 25 | 26 | # run all tests 27 | npm test 28 | 29 | vue-router文档 30 | https://router.vuejs.org/zh-cn/ 31 | 32 | ElementUi 33 | http://element-cn.eleme.io/#/zh-CN 34 | 35 | axio中文使用文档 36 | https://www.kancloud.cn/yunye/axios/234845 37 | 38 | moment中文文档 39 | http://momentjs.cn/docs/ 40 | ``` 41 | 42 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 43 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.8 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: false, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'cheap-module-eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | cssSourceMap: true, 44 | }, 45 | 46 | build: { 47 | // Template for index.html 48 | index: path.resolve(__dirname, '../dist/index.html'), 49 | 50 | // Paths 51 | assetsRoot: path.resolve(__dirname, '../dist'), 52 | assetsSubDirectory: 'static', 53 | assetsPublicPath: '/', 54 | 55 | /** 56 | * Source Maps 57 | */ 58 | 59 | productionSourceMap: true, 60 | // https://webpack.js.org/configuration/devtool/#production 61 | devtool: '#source-map', 62 | 63 | // Gzip off by default as many popular static hosts such as 64 | // Surge or Netlify already gzip all static assets for you. 65 | // Before setting to `true`, make sure to: 66 | // npm install --save-dev compression-webpack-plugin 67 | productionGzip: false, 68 | productionGzipExtensions: ['js', 'css'], 69 | 70 | // Run the build command with an extra argument to 71 | // View the bundle analyzer report after build finishes: 72 | // `npm run build --report` 73 | // Set to `true` or `false` to always turn it on or off 74 | bundleAnalyzerReport: process.env.npm_config_report 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | pro 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pro", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "liwd ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "unit": "jest --config test/unit/jest.conf.js --coverage", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", 14 | "build": "node build/build.js" 15 | }, 16 | "dependencies": { 17 | "vue": "^2.5.2", 18 | "vue-router": "^3.0.1" 19 | }, 20 | "devDependencies": { 21 | "autoprefixer": "^7.1.2", 22 | "babel-core": "^6.22.1", 23 | "babel-eslint": "^7.1.1", 24 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 25 | "babel-jest": "^21.0.2", 26 | "babel-loader": "^7.1.1", 27 | "babel-plugin-dynamic-import-node": "^1.2.0", 28 | "babel-plugin-syntax-jsx": "^6.18.0", 29 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 30 | "babel-plugin-transform-runtime": "^6.22.0", 31 | "babel-plugin-transform-vue-jsx": "^3.5.0", 32 | "babel-preset-env": "^1.3.2", 33 | "babel-preset-stage-2": "^6.22.0", 34 | "babel-register": "^6.22.0", 35 | "chalk": "^2.0.1", 36 | "chromedriver": "^2.27.2", 37 | "copy-webpack-plugin": "^4.0.1", 38 | "cross-spawn": "^5.0.1", 39 | "css-loader": "^0.28.0", 40 | "eslint": "^3.19.0", 41 | "eslint-config-standard": "^10.2.1", 42 | "eslint-friendly-formatter": "^3.0.0", 43 | "eslint-loader": "^1.7.1", 44 | "eslint-plugin-html": "^3.0.0", 45 | "eslint-plugin-import": "^2.7.0", 46 | "eslint-plugin-node": "^5.2.0", 47 | "eslint-plugin-promise": "^3.4.0", 48 | "eslint-plugin-standard": "^3.0.1", 49 | "extract-text-webpack-plugin": "^3.0.0", 50 | "file-loader": "^1.1.4", 51 | "friendly-errors-webpack-plugin": "^1.6.1", 52 | "html-webpack-plugin": "^2.30.1", 53 | "jest": "^21.2.0", 54 | "jest-serializer-vue": "^0.3.0", 55 | "nightwatch": "^0.9.12", 56 | "node-notifier": "^5.1.2", 57 | "optimize-css-assets-webpack-plugin": "^3.2.0", 58 | "ora": "^1.2.0", 59 | "portfinder": "^1.0.13", 60 | "postcss-import": "^11.0.0", 61 | "postcss-loader": "^2.0.8", 62 | "postcss-url": "^7.2.1", 63 | "rimraf": "^2.6.0", 64 | "selenium-server": "^3.0.1", 65 | "semver": "^5.3.0", 66 | "shelljs": "^0.7.6", 67 | "uglifyjs-webpack-plugin": "^1.1.1", 68 | "url-loader": "^0.5.8", 69 | "vue-jest": "^1.0.2", 70 | "vue-loader": "^13.3.0", 71 | "vue-style-loader": "^3.0.1", 72 | "vue-template-compiler": "^2.5.2", 73 | "webpack": "^3.6.0", 74 | "webpack-bundle-analyzer": "^2.9.0", 75 | "webpack-dev-server": "^2.9.1", 76 | "webpack-merge": "^4.1.0" 77 | }, 78 | "engines": { 79 | "node": ">= 6.0.0", 80 | "npm": ">= 3.0.0" 81 | }, 82 | "browserslist": [ 83 | "> 1%", 84 | "last 2 versions", 85 | "not ie <= 8" 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liwudi/Vue/8295d3d9720e2efacb452b5970a486ea4380625f/vue-cli-pro/Pro/src/assets/logo.png -------------------------------------------------------------------------------- /vue-cli-pro/Pro/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | 35 | 51 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/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 | import router from './router' 6 | 7 | Vue.config.productionTip = false 8 | 9 | /* eslint-disable no-new */ 10 | new Vue({ 11 | el: '#app', 12 | router, 13 | template: '', 14 | components: { App } 15 | }) 16 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import HelloWorld from '@/components/HelloWorld' 4 | 5 | Vue.use(Router) 6 | 7 | export default new Router({ 8 | routes: [ 9 | { 10 | path: '/', 11 | name: 'HelloWorld', 12 | component: HelloWorld 13 | } 14 | ] 15 | }) 16 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liwudi/Vue/8295d3d9720e2efacb452b5970a486ea4380625f/vue-cli-pro/Pro/static/.gitkeep -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // The assertion name is the filename. 3 | // Example usage: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // For more information on custom assertions see: 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | 10 | exports.assertion = function (selector, count) { 11 | this.message = 'Testing if element <' + selector + '> has count: ' + count 12 | this.expected = count 13 | this.pass = function (val) { 14 | return val === this.expected 15 | } 16 | this.value = function (res) { 17 | return res.value 18 | } 19 | this.command = function (cb) { 20 | var self = this 21 | return this.api.execute(function (selector) { 22 | return document.querySelectorAll(selector).length 23 | }, [selector], function (res) { 24 | cb.call(self, res) 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#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: require('selenium-server').path, 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 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | 4 | const webpack = require('webpack') 5 | const DevServer = require('webpack-dev-server') 6 | 7 | const webpackConfig = require('../../build/webpack.prod.conf') 8 | const devConfigPromise = require('../../build/webpack.dev.conf') 9 | 10 | let server 11 | 12 | devConfigPromise.then(devConfig => { 13 | const devServerOptions = devConfig.devServer 14 | const compiler = webpack(webpackConfig) 15 | server = new DevServer(compiler, devServerOptions) 16 | const port = devServerOptions.port 17 | const host = devServerOptions.host 18 | return server.listen(port, host) 19 | }) 20 | .then(() => { 21 | // 2. run the nightwatch test suite against it 22 | // to run in additional browsers: 23 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 24 | // 2. add it to the --env flag below 25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 26 | // For more information on Nightwatch's config file, see 27 | // http://nightwatchjs.org/guide#settings-file 28 | let opts = process.argv.slice(2) 29 | if (opts.indexOf('--config') === -1) { 30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 31 | } 32 | if (opts.indexOf('--env') === -1) { 33 | opts = opts.concat(['--env', 'chrome']) 34 | } 35 | 36 | const spawn = require('cross-spawn') 37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 38 | 39 | runner.on('exit', function (code) { 40 | server.close() 41 | process.exit(code) 42 | }) 43 | 44 | runner.on('error', function (err) { 45 | server.close() 46 | throw err 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/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.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | mapCoverage: true, 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/main.js', 27 | '!src/router/index.js', 28 | '!**/node_modules/**' 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /vue-cli-pro/Pro/test/unit/specs/HelloWorld.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import HelloWorld from '@/components/HelloWorld' 3 | 4 | describe('HelloWorld.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(HelloWorld) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .toEqual('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /vue-components/component1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 | 12 | 16 |
17 | 18 |
19 | 32 | 33 | -------------------------------------------------------------------------------- /vue-components/component10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 14 | 15 | 16 | 17 |
18 | 19 |
20 | 50 | 51 | -------------------------------------------------------------------------------- /vue-components/component11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
{{bar}}
11 | 12 |
13 | 31 | 32 | -------------------------------------------------------------------------------- /vue-components/component12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 |

{{something}}

12 | 13 |
14 | 15 | 20 |

{{something2}}

21 |
22 | 31 | 32 | -------------------------------------------------------------------------------- /vue-components/component13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 13 | > 14 |
15 | 34 | 35 | -------------------------------------------------------------------------------- /vue-components/component14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | 47 | 48 | -------------------------------------------------------------------------------- /vue-components/component15.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | {{message}} 12 | 13 | 14 |
15 | 31 | 32 | -------------------------------------------------------------------------------- /vue-components/component16.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | {{message}} 12 | 13 | 14 |
15 | 40 | 41 | -------------------------------------------------------------------------------- /vue-components/component2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | 24 | 25 | -------------------------------------------------------------------------------- /vue-components/component3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 |
14 | 27 | 28 | -------------------------------------------------------------------------------- /vue-components/component4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 | 12 | 15 |
16 | 17 |
18 | 31 | 32 | -------------------------------------------------------------------------------- /vue-components/component5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 | 12 | 15 |
16 | 17 |
18 | 28 | 29 | -------------------------------------------------------------------------------- /vue-components/component6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 | 15 | 16 |
17 | 30 | 31 | -------------------------------------------------------------------------------- /vue-components/component7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | 29 | 30 | -------------------------------------------------------------------------------- /vue-components/component8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 |
12 | 30 | 31 | -------------------------------------------------------------------------------- /vue-components/component9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 14 | 15 | 16 | 17 |
18 | 19 |
20 | 36 | 37 | -------------------------------------------------------------------------------- /vue-components/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | 29 | 30 | -------------------------------------------------------------------------------- /vue-demo/demo1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
{{message}}
10 | 18 | 19 | -------------------------------------------------------------------------------- /vue-demo/demo2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 |
鼠标悬停几秒钟查看此处动态绑定的提示信息!
10 | 18 | 19 | -------------------------------------------------------------------------------- /vue-demo/demo3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |

message为true

11 |

message为false

12 |
13 | 21 | 22 | -------------------------------------------------------------------------------- /vue-demo/demo4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 |
  • 姓名:{{item.name}},年龄:{{item.age}}
  • 12 |
13 |
14 | 22 | 23 | -------------------------------------------------------------------------------- /vue-demo/demo5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 |

用户输入的值:{{message}}

12 |
13 | 21 | 22 | -------------------------------------------------------------------------------- /vue-demo/demo6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 | 11 |
12 | 25 | 26 | -------------------------------------------------------------------------------- /vue-demo/demo7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 | 12 | 13 |
14 | 15 |
16 | 25 | 26 | -------------------------------------------------------------------------------- /vue-demo/demo7_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 7 | 8 | 9 |
10 |
    11 | 12 | 16 |
17 | 18 |
19 | 32 | 33 | -------------------------------------------------------------------------------- /vue-demo/demo8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue-demo 6 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 |

23 | {{message}} 24 |

25 |
26 | 27 |
28 | 42 | 43 | -------------------------------------------------------------------------------- /vue-router/router1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vue-router 6 | 7 | 8 | 9 | 10 |
11 |

Hello App!

12 |

13 | 14 | 15 | 16 | Go to Foo 17 | Go to Bar 18 |

19 | 20 | 21 | 22 |
23 | 24 | 25 | 48 | -------------------------------------------------------------------------------- /vue-router/router2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vue-router 6 | 7 | 8 | 9 | 10 |
11 |

Hello App!

12 |

13 | 14 | 15 | 16 | Go to Foo 17 | Go to Bar 18 |

19 | 20 | 21 | 22 |
23 | 24 | 25 | 48 | -------------------------------------------------------------------------------- /vuex-demo/vuex1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vuex学习 6 | 7 | 8 | 9 | 10 | 11 |
12 |

{{ count }}

13 |

14 | 15 | 16 |

17 |
18 | 19 | 52 | 53 | -------------------------------------------------------------------------------- /vuex-demo/vuex2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vuex学习 6 | 7 | 8 | 9 | 10 | 11 |
12 |

{{ count }}

13 |

14 | 15 | 16 |

17 |
18 | 19 | 58 | 59 | --------------------------------------------------------------------------------