Skip to content

Commit e51dafc

Browse files
committed
fix some error and readme
1 parent 3975e6a commit e51dafc

File tree

9 files changed

+1960
-69
lines changed

9 files changed

+1960
-69
lines changed

.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": ["es2015", "stage-2"],
3+
"plugins": ["transform-runtime"],
4+
"comments": false,
5+
"env": {
6+
"test": {
7+
"plugins": [ "istanbul" ]
8+
}
9+
}
10+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
node_modules
3+
*.log
4+
.idea
5+
npm-debug.log*

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 6.11.0
4+
5+
script: npm run build

README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
1-
# vuejs-modal
2-
A simple vue modal plugin
1+
# vuejs-modal ![travis-ci](https://travis-ci.org/shaodahong/vuejs-modal.svg?branch=master)
2+
3+
A simple、highly customizable vue modal plugin.
4+
5+
## Introduction
6+
7+
A file corresponds to a modal, and registered to vue prototype, so I can use it through `this`, it gives me a state of a `promise`, so I can get this modal state.
8+
9+
## Installation
10+
11+
```bash
12+
$ npm i vuejs-modal -S
13+
```
14+
15+
## Usage
16+
17+
```javascript
18+
import Modal from 'vuejs-modal'
19+
20+
Vue.use(Modal, {
21+
modals //your modals, is a object
22+
})
23+
```
24+
25+
Use in component:
26+
27+
```javascript
28+
<template>
29+
<!-- your html -->
30+
</template>
31+
32+
<script>
33+
export default {
34+
methods: {
35+
show: function () {
36+
this.$modal.confirm()
37+
}
38+
}
39+
}
40+
</script>
41+
```
42+
43+
## options
44+
45+
```javascript
46+
Vue.use(Modal, {
47+
// Use this in the component modal called the name, the default is $modal.
48+
name: '$modal',
49+
50+
// modal div id name, the default is modal.
51+
id: 'modal',
52+
53+
// your modals, is a object, the default is null, this object key is called the modal name, value is a vue component.
54+
modals: {
55+
confirm: confirm.component
56+
},
57+
58+
// modal style, the default hava a z-index
59+
style: {
60+
zIndex: 1000
61+
}
62+
})
63+
```

build/build.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require('shelljs/global');
2+
var webpack = require('webpack');
3+
var path = require('path');
4+
5+
rm('-rf', 'dist/');
6+
7+
module.exports = {
8+
entry: {
9+
index: './src/index.js'
10+
},
11+
output: {
12+
path: path.resolve(__dirname, '../dist'),
13+
publicPath: '',
14+
filename: '[name].js'
15+
},
16+
resolve: {
17+
extensions: ['*', '.js', '.json'],
18+
},
19+
module: {
20+
rules: [{
21+
test: /\.js$/,
22+
exclude: /(node_modules)/,
23+
use: {
24+
loader: 'babel-loader'
25+
}
26+
}]
27+
}
28+
}

0 commit comments

Comments
 (0)