Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYSzys committed Jun 23, 2018
0 parents commit d306db8
Show file tree
Hide file tree
Showing 15 changed files with 12,896 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
["env", { "modules": false }],
"stage-3"
]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules/
dist/
npm-debug.log
yarn-error.log

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# vue-canvas-nest

> A Vue.js component for canvas-nest
## Install

``` bash
# install dependencies
npm install

# or use yarn
yarn add vue-canvas-nest
```

## Usage

### Registe component
```js
import vueCanvasNest from 'vue-canvas-nest'
export default {
components: { vueCanvasNest }
}

```

### How to use

#### Simply use:
```html
<vue-canvas-nest></vue-canvas-nest>
```

#### With config:
```html
<vue-canvas-nest :config="{color:'255,0,0', count: 88}"></vue-canvas-nest>
```

## Contributors
- [ZYSzys](https://github.com/ZYSzys)

## Thanks
- [canvas-nest.js](https://github.com/hustcc/canvas-nest.js)

## License

The plugin is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
69 changes: 69 additions & 0 deletions example/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<div id="app">
<img src="./assets/logo.png">
<vue-canvas-nest :config="config"/>
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
</ul>
<h2>Ecosystem</h2>
<ul>
<li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
<li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
<li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
</ul>

</div>
</template>
<script>
import vueCanvasNest from './components/vueCanvasNest'
export default {
name: 'app',
components: { vueCanvasNest },
data() {
return {
msg: 'Welcome to Your Vue.js App',
config: {
color: '0,0,255',
count: 188,
}
}
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
h1,
h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
Binary file added example/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions example/components/vueCanvasNest.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<div class="vue-canvas-nest-element" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;z-index: -1;">
</div>
</template>
<script>
import CanvasNest from 'canvas-nest.js';
export default {
name: 'vueCanvasNest',
props: {
config: {
type: Object,
default () {
return {
color: '255,0,0',
count: 88,
}
}
}
},
data() {
return {
cn: ''
}
},
mounted() {
const el = document.querySelector('.vue-canvas-nest-element')
this.cn = new CanvasNest(el, this.config)
},
beforeDestroy() {
this.cn.destroy()
}
}
</script>
7 changes: 7 additions & 0 deletions example/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Vue from 'vue'
import App from './App.vue'

new Vue({
el: '#app',
render: h => h(App)
})
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>vue-canvas-nest</title>
</head>
<body>
<div id="app"></div>
<script src="/dist/build.js"></script>
</body>
</html>
Loading

0 comments on commit d306db8

Please sign in to comment.