Skip to content

Commit

Permalink
releases v1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Aug 24, 2019
1 parent 1f565f5 commit 1fec509
Show file tree
Hide file tree
Showing 11 changed files with 721 additions and 75 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ npm-debug.log*
node_modules
coverage
package-lock.json

types
yarn-error.log
types
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# chart.xkcd-vue

[chart.xkcd-vue's documentation](https://shiyiya.github.io/chart.xkcd-vue/)

[chart.xkcd](https://timqian.com/chart.xkcd/) component for Vue.

## what's chart.xkcd?
Expand All @@ -13,7 +15,7 @@ Check out the [documentation](https://timqian.com/chart.xkcd/) for more instruct
## Requirements

- Vue >= 2.0.0
- chart.xkcd >= 1.0.5
- chart.xkcd >= 1.0.7

## Installation

Expand All @@ -26,18 +28,18 @@ npm i -S chart.xkcd-vue
### Auto register components

You can simply import it and use it.
** All components will be prefixed with `ChartXkcd` **
**All components will be prefixed with `chartxkcd-`**

```js
import Vue from 'vue'
import ChartXkcdVue from 'chart.xkcd-vue'
import chartXkcdVue from 'chart.xkcd-vue'

// ↓↓↓ will auto register all chart.xkcd component.
// ↓↓↓ eg: chartxkcd-line: 'Line', chartxkcd-bar: 'Pie', chartxkcd-pie: 'Bar' ...
Vue.use(ChartXkcdVue)
Vue.use(chartXkcdVue)
```

When chart.xkcd-vue is included by `<script>`, it will be installed automatically if `window.Vue` and `window.chartXkcd` exists, ohterwise you should to install it manually by calling `Vue.use(window.ChartXkcdVue['default']);`.
When chart.xkcd-vue is included by `<script>`, it will be installed automatically if `window.Vue` and `window.chartXkcd` exists, ohterwise you should to install it manually by calling `Vue.use(window.chartXkcdVue['default']);`.

```js
{
Expand Down Expand Up @@ -76,7 +78,7 @@ When chart.xkcd-vue is included by `<script>`, it will be installed automaticall
npm i -S chart.xkcd
```

** All components need to be prefixed with `ChartXkcd`**
**All components need to be prefixed with `chartxkcd-`**

```js
import Vue from 'vue'
Expand Down
53 changes: 53 additions & 0 deletions dist/chart.xkcd-vue.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import chartXkcd from 'chart.xkcd';

var ctors = {
'chartxkcd-line': 'Line',
'chartxkcd-bar': 'Bar',
'chartxkcd-pie': 'Pie',
'chartxkcd-xy': 'XY'
};

function create(chartXkcd$$1, name) {
var ctorsName = ctors[name];
if (!ctorsName) {
return null
}
return {
name: name,
props: {
config: { type: Object, required: true }
},
// TODO
// watch: {
// config: {
// handler: function () {},
// deep: true
// }
// },

mounted: function () {
// eslint-disable-next-line no-new
new chartXkcd$$1[ctorsName](this.$el, this.config);
},

// beforeDestroy: function () {},

render: function (createElement) {
return createElement('svg')
}
}
}

function install(Vue) {
for (var name in ctors) {
var component = create(chartXkcd, name);
component && Vue.component(name, component);
}
}

if (typeof window !== 'undefined' && window.Vue && window.chartXkcd) {
install(window.Vue);
}

export default install;
export { create as genComponent };
2 changes: 1 addition & 1 deletion dist/chart.xkcd-vue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('chart.xkcd')) :
typeof define === 'function' && define.amd ? define(['exports', 'chart.xkcd'], factory) :
(global = global || self, factory(global.ChartXkcdVue = {}, global.chartXkcd));
(global = global || self, factory(global.chartXkcdVue = {}, global.chartXkcd));
}(this, function (exports, chartXkcd) { 'use strict';

chartXkcd = chartXkcd && chartXkcd.hasOwnProperty('default') ? chartXkcd['default'] : chartXkcd;
Expand Down
2 changes: 1 addition & 1 deletion dist/chart.xkcd-vue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1fec509

Please sign in to comment.