├── .babelrc ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── README.md ├── build ├── webpack.dev.config.js └── webpack.prod.config.js ├── examples ├── App.vue ├── index.html └── main.js ├── package.json └── src ├── Dialog.vue ├── assets └── images │ └── close.svg └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", "es2017" 4 | ], 5 | "plugins": [ 6 | "transform-es2015-modules-commonjs" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | build/* -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "env": { 4 | "browser": true, 5 | "commonjs": true, 6 | "es6": true, 7 | "node": true 8 | }, 9 | "parserOptions": { 10 | "ecmaVersion": 8, 11 | "sourceType": "module" 12 | }, 13 | "rules": { 14 | "no-const-assign": "warn", 15 | "no-this-before-super": "warn", 16 | "no-undef": "warn", 17 | "no-unreachable": "warn", 18 | "no-unused-vars": "warn", 19 | "constructor-super": "warn", 20 | "valid-typeof": "warn", 21 | "semi": [ 22 | "warn", 23 | "never" 24 | ], 25 | "quotes": [ 26 | "warn", 27 | "single" 28 | ], 29 | "arrow-parens": 0, 30 | "generator-star-spacing": 0, 31 | "space-before-function-paren": 0 32 | } 33 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist 4 | lib/* 5 | !lib/.gitkeep 6 | .vscode 7 | npm-debug.log 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-dialog 2 | 3 | This is yet another vue dialog component. 4 | 5 | ## Install 6 | 7 | Use npm to download code: 8 | 9 | ``` 10 | npm install hsy-vue-dialog -S 11 | ``` 12 | 13 | then import it into your project, add below code into your `main.js`: 14 | 15 | ```js 16 | import Dialog from 'hsy-vue-dialog' 17 | 18 | Vue.use(Dialog) 19 | ``` 20 | 21 | ## Usage 22 | 23 | ```html 24 | 25 | 26 | 27 |
Remove
28 |
29 |
This operation is irreversible, are you sure?
30 |
31 | 32 | 33 |
34 |
35 |
36 | 37 | 52 | ``` 53 | 54 | ## Props 55 | 56 | | Prop | Description | Type | Accepted Values | Default | 57 | |:----------------|:------------------------------------------------|:--------|:----------------|:--------| 58 | | value | whether dialog is visible or not | Boolean | -- | false | 59 | | closeButton | whether close button is visible or not | Boolean | -- | true | 60 | | clickMask2Close | if dialog should be closed when mask is clicked | Boolean | -- | true | 61 | 62 | ## Demo 63 | 64 | [demo](http://vue-demo.hsiaosiyuan.com/#/dialog) 65 | 66 | ## Screenshot 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /build/webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var HtmlWebpackPlugin = require('html-webpack-plugin') 3 | 4 | module.exports = { 5 | entry: './examples/main.js', 6 | resolve: { 7 | extensions: ['.js', '.vue', '.json'], 8 | alias: { 9 | main: path.resolve(__dirname, '../src') 10 | }, 11 | }, 12 | output: { 13 | path: path.resolve(__dirname, '../dist/dev'), 14 | publicPath: '/', 15 | filename: 'index.js' 16 | }, 17 | devServer: { 18 | contentBase: path.resolve(__dirname, '../dist/dev'), 19 | compress: false, 20 | port: 8080 21 | }, 22 | plugins: [ 23 | new HtmlWebpackPlugin({ 24 | filename: path.resolve(__dirname, '../dist/dev/index.html'), 25 | template: 'examples/index.html', 26 | inject: true 27 | }) 28 | ], 29 | module: { 30 | loaders: [{ 31 | test: /\.vue$/, 32 | loader: 'vue-loader' 33 | }, { 34 | test: /\.js$/, 35 | loaders: ['babel-loader', 'eslint-loader'], 36 | exclude: /node_modules/ 37 | }, { 38 | test: /\.css$/, 39 | loader: 'style-loader!css-loader' 40 | }, { 41 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 42 | loader: 'url-loader', 43 | query: { 44 | limit: 10000, 45 | name: 'img/[name].[hash:7].[ext]' 46 | } 47 | }, { 48 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 49 | loader: 'url-loader', 50 | query: { 51 | limit: 10000, 52 | name: 'fonts/[name].[hash:7].[ext]' 53 | } 54 | }] 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /build/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | 3 | module.exports = { 4 | entry: './src/index.js', 5 | devtool: 'source-map', 6 | resolve: { 7 | extensions: ['.js', '.vue', '.json'] 8 | }, 9 | output: { 10 | path: path.resolve(__dirname, '../lib'), 11 | filename: 'index.js', 12 | libraryTarget: 'commonjs2' 13 | }, 14 | module: { 15 | loaders: [{ 16 | test: /\.vue$/, 17 | loader: 'vue-loader' 18 | }, { 19 | test: /\.js$/, 20 | loaders: ['babel-loader', 'eslint-loader'], 21 | exclude: /node_modules/ 22 | }, { 23 | test: /\.css$/, 24 | loader: 'style-loader!css-loader' 25 | }, { 26 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 27 | loader: 'url-loader', 28 | query: { 29 | limit: 10000, 30 | name: 'img/[name].[hash:7].[ext]' 31 | } 32 | }, { 33 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 34 | loader: 'url-loader', 35 | query: { 36 | limit: 10000, 37 | name: 'fonts/[name].[hash:7].[ext]' 38 | } 39 | }] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/App.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 43 | 44 | 82 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | test 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import Dialog from 'main' 4 | 5 | Vue.use(Dialog) 6 | 7 | new Vue({ 8 | el: '#app', 9 | render: h => h(App) 10 | }) 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hsy-vue-dialog", 3 | "version": "0.0.7", 4 | "description": "vue dialog component", 5 | "author": "hsiaosiyuan0 ", 6 | "main": "lib/index.js", 7 | "scripts": { 8 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot --config ./build/webpack.dev.config.js", 9 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config ./build/webpack.prod.config.js", 10 | "prepublish": "npm run build" 11 | }, 12 | "devDependencies": { 13 | "babel-core": "^6.21.0", 14 | "babel-eslint": "^6.1.2", 15 | "babel-loader": "^6.2.10", 16 | "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", 17 | "babel-preset-es2015": "^6.22.0", 18 | "babel-preset-es2017": "^6.16.0", 19 | "cross-env": "^3.1.4", 20 | "css-loader": "^0.23.0", 21 | "eslint": "^3.12.2", 22 | "eslint-loader": "^1.6.1", 23 | "file-loader": "^0.8.4", 24 | "html-webpack-plugin": "^2.28.0", 25 | "json-loader": "^0.5.4", 26 | "style-loader": "^0.13.1", 27 | "url-loader": "^0.5.7", 28 | "vue": "^2.1.10", 29 | "vue-loader": "^10.3.0", 30 | "vue-style-loader": "^2.0.0", 31 | "vue-template-compiler": "^2.1.10", 32 | "webpack": "^2.2.1", 33 | "webpack-dev-server": "^2.3.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Dialog.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 209 | 210 | 320 | -------------------------------------------------------------------------------- /src/assets/images/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Dialog from './Dialog' 2 | 3 | const install = (Vue) => { 4 | Vue.component(Dialog.name, Dialog) 5 | } 6 | 7 | export default { 8 | version: '0.0.1', 9 | install 10 | } 11 | --------------------------------------------------------------------------------