Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
511 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"undef": true, | ||
"unused": true, | ||
"esversion": 6, | ||
"asi": true, | ||
"browser": true, | ||
"node": true, | ||
"devel": true, | ||
"predef": ["Vue", "VueWaves"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,51 @@ | ||
# vue-waves | ||
|
||
> it's a vuejs version of waves Based on https://github.com/fians/Waves | ||
A Vue.js version of waves based on https://github.com/fians/Waves. | ||
|
||
## How to Use | ||
|
||
``` bash | ||
# install dependencies | ||
### SetUp | ||
|
||
```bash | ||
npm install vue-waves | ||
``` | ||
|
||
then in the js file | ||
``` javascript | ||
|
||
```javascript | ||
var Vue = require('vue') | ||
var vueWaves = require('vue-waves'); | ||
var VueWaves = require('vue-waves'); | ||
|
||
Vue.use(vueWaves); | ||
Vue.use(VueWaves); | ||
``` | ||
|
||
then in vue file | ||
### Config | ||
|
||
```javascript | ||
Vue.use(VueWaves, { | ||
name: 'waves' // Vue指令名称 | ||
duration: 500, // 涟漪效果持续时间 | ||
delay: 200 // 延时显示涟漪效果 | ||
}) | ||
``` | ||
|
||
``` html | ||
<teamplate> | ||
<div v-waves> | ||
</teamlate> | ||
### Usage | ||
|
||
```html | ||
<button v-waves.button>Vue-Waves</button> | ||
``` | ||
|
||
Vue directive: | ||
``` | ||
v-waves.button 按钮 | ||
v-waves.circle 圆形 | ||
v-waves.block 块 | ||
v-waves.float 阴影效果 | ||
v-waves.light 亮色涟漪 | ||
v-waves.classic ?? | ||
``` | ||
|
||
Demo: | ||
|
||
git clone https://github.com/Teddy-Zhu/vue-waves.git | ||
open vue-waves/demo/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>vue-waves</title> | ||
<script src="http://cdn.bootcss.com/vue/2.0.3/vue.js" charset="utf-8"></script> | ||
<script src="../dist/vue-waves.js" charset="utf-8"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="app"> | ||
<h1 class="message" v-waves.block> | ||
{{ message }} | ||
</h1> | ||
<section> | ||
<a v-for="color in colors" :style="{background:color}" v-waves.button>Vue Waves</a> | ||
</section> | ||
<section> | ||
<button type="button" v-for="color in colors" :style="{background:color}" v-waves.button.float>Vue Waves</button> | ||
</section> | ||
<section> | ||
<input type="button" v-for="color in colors" :style="{background:color}" v-waves.button.light value="Vue Waves"> | ||
</section> | ||
<section> | ||
<i v-for="color in colors" :style="{background:color}" v-waves.circle>V</i> | ||
</section> | ||
<section> | ||
<i v-for="color in colors" :style="{background:color}" v-waves.circle.float>V</i> | ||
</section> | ||
<section> | ||
<img v-waves.block src="https://farm2.staticflickr.com/1297/1091511802_2fb2451ecc_n.jpg"> | ||
</section> | ||
</div> | ||
<style media="screen"> | ||
#app { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.message { | ||
padding: 16px; | ||
} | ||
|
||
section { | ||
margin-top: 16px; | ||
} | ||
|
||
a, | ||
button, | ||
input, | ||
i { | ||
margin-left: 8px; | ||
margin-right: 8px; | ||
color: #fff!important; | ||
} | ||
</style> | ||
<script type="text/javascript"> | ||
Vue.use(VueWaves) | ||
new Vue({ | ||
el: '#app', | ||
data: { | ||
message: 'Hello Vue Waves!', | ||
colors: [ | ||
'rgb(3, 169, 244)', | ||
'rgb(76, 175, 80)', | ||
'rgb(255, 235, 59)', | ||
'rgb(255, 152, 0)', | ||
'rgb(255, 87, 34)', | ||
'rgb(233, 30, 99)', | ||
] | ||
} | ||
}) | ||
</script> | ||
</body> | ||
|
||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import './waves.css' | ||
import Waves from './waves.js' | ||
|
||
module.exports = { | ||
install(Vue, options = { name: 'waves' }) { | ||
Vue.directive(options.name, { | ||
inserted(el, binding) { | ||
let classes = ['button', 'circle', 'block', 'float', 'light', 'classic'] | ||
.filter(cls => binding.modifiers[cls]) | ||
.map(cls => `waves-${cls}`) | ||
Waves.attach(el, classes) | ||
} | ||
}) | ||
Vue.mixin({ | ||
created: function() { | ||
Waves.init(options); | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
{ | ||
"name": "vue-waves", | ||
"homepage": "http://www.eicoding.com", | ||
"version": "0.0.5", | ||
"description": "it's a vuejs version of waves", | ||
"author": "teddyzhu", | ||
"scripts": { | ||
|
||
}, | ||
"dependencies": { | ||
"vue": "^1.0.21", | ||
"css-loader": "^0.23.1", | ||
"cssnext-loader": "^1.0.1" | ||
}, | ||
"readme":"README.md", | ||
"main": "waves.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:Teddy-Zhu/vue-waves.git" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
}, | ||
"files": [ | ||
"Readme.md", | ||
"waves.js", | ||
"waves.css" | ||
] | ||
"name": "vue-waves", | ||
"homepage": "https://github.com/Teddy-Zhu/vue-waves", | ||
"version": "0.1.0", | ||
"description": "A Vue.js version of waves", | ||
"author": "teddyzhu", | ||
"scripts": { | ||
"build": "webpack -p" | ||
}, | ||
"dependencies": {}, | ||
"readme": "README.md", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:Teddy-Zhu/vue-waves.git" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^6.17.0", | ||
"babel-loader": "^6.2.5", | ||
"babel-preset-es2015": "^6.16.0", | ||
"css-loader": "^0.25.0", | ||
"style-loader": "^0.13.1", | ||
"vue": "^2.0.3", | ||
"webpack": "^1.13.2" | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
Oops, something went wrong.