├── .browserslistrc ├── babel.config.js ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── composing-components.pdf ├── src ├── views │ ├── Home.vue │ ├── ExampleOne.vue │ ├── Dynamic.vue │ ├── ExampleTwo.vue │ └── ExampleThree.vue ├── main.js ├── components │ ├── AppButton.vue │ ├── AppDropdown.vue │ ├── AppSelect.vue │ ├── Layout.vue │ └── AppTooltip.vue ├── App.vue └── router.js ├── .editorconfig ├── .gitignore ├── .eslintrc.js ├── README.md └── package.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shentao/composing-components/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /composing-components.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shentao/composing-components/HEAD/composing-components.pdf -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | '@vue/standard' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import { library } from '@fortawesome/fontawesome-svg-core' 5 | import { fas } from '@fortawesome/free-solid-svg-icons' 6 | import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' 7 | 8 | library.add(fas) 9 | 10 | Vue.component('AppIcon', FontAwesomeIcon) 11 | 12 | Vue.config.productionTip = false 13 | 14 | new Vue({ 15 | router, 16 | render: h => h(App) 17 | }).$mount('#app') 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # composing-components 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /src/components/AppButton.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 27 | -------------------------------------------------------------------------------- /src/views/ExampleOne.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 30 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | composing-components 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 23 | -------------------------------------------------------------------------------- /src/views/Dynamic.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 30 | 31 | 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "composing-components", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@fortawesome/fontawesome-svg-core": "^1.2.14", 12 | "@fortawesome/free-solid-svg-icons": "^5.7.1", 13 | "@fortawesome/vue-fontawesome": "^0.1.5", 14 | "vue": "2.6.3", 15 | "vue-global-events": "^1.1.0", 16 | "vue-router": "^3.0.1" 17 | }, 18 | "devDependencies": { 19 | "@vue/cli-plugin-babel": "^3.1.1", 20 | "@vue/cli-plugin-eslint": "^3.1.5", 21 | "@vue/cli-service": "^3.4.0", 22 | "@vue/eslint-config-standard": "^4.0.0", 23 | "babel-eslint": "^10.0.1", 24 | "eslint": "^5.8.0", 25 | "eslint-plugin-vue": "^5.0.0", 26 | "stylus": "^0.54.5", 27 | "stylus-loader": "^3.0.2", 28 | "vue-template-compiler": "2.6.3" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/views/ExampleTwo.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 33 | 34 | 41 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Home from './views/Home.vue' 4 | import ExampleOne from './views/ExampleOne.vue' 5 | import ExampleTwo from './views/ExampleTwo.vue' 6 | import ExampleThree from './views/ExampleThree.vue' 7 | import Dynamic from './views/Dynamic.vue' 8 | 9 | Vue.use(Router) 10 | 11 | export default new Router({ 12 | routes: [ 13 | { 14 | path: '/', 15 | name: 'home', 16 | component: Home 17 | }, 18 | { 19 | path: '/example-one', 20 | name: 'example-one', 21 | component: ExampleOne 22 | }, 23 | { 24 | path: '/example-two', 25 | name: 'example-two', 26 | component: ExampleTwo 27 | }, 28 | { 29 | path: '/example-three', 30 | name: 'example-three', 31 | component: ExampleThree 32 | }, 33 | { 34 | path: '/dynamic', 35 | name: 'dynamic', 36 | component: Dynamic 37 | } 38 | ] 39 | }) 40 | -------------------------------------------------------------------------------- /src/components/AppDropdown.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 36 | 37 | 39 | -------------------------------------------------------------------------------- /src/components/AppSelect.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 39 | 40 | 54 | -------------------------------------------------------------------------------- /src/components/Layout.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 24 | 25 | 61 | -------------------------------------------------------------------------------- /src/components/AppTooltip.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 32 | 33 | 53 | -------------------------------------------------------------------------------- /src/views/ExampleThree.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 40 | 41 | 47 | --------------------------------------------------------------------------------