Categories
Top Vue Packages

Top Vue Packages for Adding Code Editors and Time Pickers

ue.js is an easy to use web app framework that we can use to develop interactive front end apps.

In this article, we’ll look at the best packages for adding code editors and time pickers.

Vue-Codemirror-Lite

Vue-Codemirror-Lite is a code viewer for Vue apps.

It has syntax highlighti

To use it, we run:

npm i vue-codemirror-lite

to install it.

Then we can use it by writing:

<template>
  <codemirror :value="code"></codemirror>
</template>

<script>
import { codemirror } from "vue-codemirror-lite";

export default {
  components: {
    codemirror
  },
  data() {
    return {
      code: 'const str = "hello world"'
    };
  }
};
</script>

We just use the codemirror component to display the code.

Also, we can assign a ref and call methods on it:

<template>
  <codemirror ref="codeEditor" :value="code"></codemirror>
</template>

<script>
import { codemirror } from "vue-codemirror-lite";

export default {
  components: {
    codemirror
  },
  data() {
    return {
      code: 'const str = "hello world"'
    };
  },
  computed: {
    editor() {
      return this.$refs.codeEditor.editor;
    }
  },
  mounted() {
    this.editor.focus();
  }
};
</script>

Vue Prism Editor

Vue Prism Editor is another code editor for Vue apps.

To use it, we run:

npm i vue-prism-editor prism

to install it.

Prism is a required dependency.

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import "prismjs";
import "prismjs/themes/prism-tomorrow.css";
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <prism-editor class="my-editor" :code="code" language="js"></prism-editor>
</template>

<script>
import PrismEditor from "vue-prism-editor";
export default {
  components: {
    PrismEditor
  },
  data() {
    return {
      code: `const a = 'foo'`
    };
  }
};
</script>

<style>
.my-editor {
  height: 300px;
}
</style>

We use the prism-editor component.

To display it, we set the height of the editor.

The code prop has the code.

language is set to js to indicate that we display JavaScript.

We can display line numbers with the linenumbers prop:

<template>
  <prism-editor lineNumbers class="my-editor" :code="code" language="js"></prism-editor>
</template>

<script>
import PrismEditor from "vue-prism-editor";
export default {
  components: {
    PrismEditor
  },
  data() {
    return {
      code: `const a = 'foo'`
    };
  }
};
</script>

<style>
.my-editor {
  height: 300px;
}
</style>

v-jsoneditor

v-jsoneditor is a JSON editor that’s made for Vue apps.

To use it, we run:

npm i v-jsoneditor

to install it.

Then we can use it by writing:

<template>
  <div>
    <v-jsoneditor v-model="json" :plus="false" height="400px" @error="onError"></v-jsoneditor>
  </div>
</template>

<script>
import VJsoneditor from "v-jsoneditor";

export default {
  name: "app",
  components: {
    VJsoneditor
  },
  data() {
    return {
      json: {
        hello: "world"
      }
    };
  },
  methods: {
    onError() {
      console.log("error");
    }
  }
};
</script>

We use the v-jsoneditor component to add it.

v-model binds the JSON value to the editor.

The error event is emitted and we can handle it with the onError method.

We can set some options with the options prop.

To use it, we write:

<template>
  <div>
    <v-jsoneditor v-model="json" :options="options" :plus="false" height="400px" @error="onError"></v-jsoneditor>
  </div>
</template>

<script>
import VJsoneditor from "v-jsoneditor";

export default {
  name: "app",
  components: {
    VJsoneditor
  },
  data() {
    return {
      json: {
        hello: "world"
      },
      options: {
        templates: [
          {
            text: "Person",
            title: "Insert a Person Node",
            className: "jsoneditor-type-object",
            field: "PersonTemplate",
            value: {
              firstName: "james",
              lastName: "smith"
            }
          }
        ]
      }
    };
  },
  methods: {
    onError() {
      console.log("error");
    }
  }
};
</script>

This allows us to add preset nodes by since we added the templates array with those fields.

plus lets us switch to full screen.

Vue2 Timepicker

Vue2 Timepicker is a handy time picker.

To use it, we run:

npm i vue2-timepicker

to install it.

Then we can write:

<template>
  <div>
    <vue-timepicker></vue-timepicker>
  </div>
</template>

<script>
import VueTimepicker from "vue2-timepicker";
import "vue2-timepicker/dist/VueTimepicker.css";

export default {
  name: "app",
  components: {
    VueTimepicker
  }
};
</script>

to use the timepicker.

We just add the vue-timerpicker component.

The format can be set and we can bind the selected value to a state:

<template>
  <div>
    <vue-timepicker v-model="time" format="HH:mm:ss"></vue-timepicker>
    <p>{{time}}</p>
  </div>
</template>

<script>
import VueTimepicker from "vue2-timepicker";
import "vue2-timepicker/dist/VueTimepicker.css";

export default {
  name: "app",
  components: {
    VueTimepicker
  },
  data() {
    return {
      time: undefined
    };
  }
};
</script>

We use v-model for binding and format to set the time format.

Conclusion

Vue-Codemirror-Lite and Vue Prism Editor are code editors for Vue apps.

v-jsoneditor is a JSON editor for Vue apps.

Vue2 Timepicker is a time picker.

Categories
Top Vue Packages

Top Vue Packages for Adding Calendars, Local Storage, Overlays, and Resizing

Vue.js is an easy to use web app framework that we can use to develop interactive front end apps.

In this article, we’ll look at how the best packages for adding calendars, overlays, and handle local storage.

vue-fullcalendar

vue-fullcalendar provides us with a simple calendar component to display events.

To use it, first we install it by running:

npm i vue-fullcalendar

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import fullCalendar from "vue-fullcalendar";

Vue.component("full-calendar", fullCalendar);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div id="app">
    <full-calendar :events="fcEvents" lang="en"></full-calendar>
  </div>
</template>

<script>
const fcEvents = [
  {
    title: "eat",
    start: "2020-05-25",
    end: "2020-05-27"
  }
];
export default {
  data() {
    return {
      fcEvents
    };
  }
};
</script>

We register the component. Then we used it in our App component.

full-calendar takes an events prop that takes an array of objects.

The objects have the title , start , and end properties.

title is the event title.

start is the start date string. end is the end date string.

It emits events when the month is changed and an event is clicked.

v-calendar

v-calendar is another calendar component.

To install it, we run:

npm i v-calendar

Now we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import Calendar from "v-calendar/lib/components/calendar.umd";
import DatePicker from "v-calendar/lib/components/date-picker.umd";

Vue.component("calendar", Calendar);
Vue.component("date-picker", DatePicker);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div id="app">
    <date-picker :mode="mode" v-model="selectedDate"/>
  </div>
</template>

<script>
export default {
  data() {
    return {
      mode: "single",
      selectedDate: null
    };
  }
};
</script>

to add a date picker.

Also, we can write:

<template>
  <div id="app">
    <calendar></calendar>
  </div>
</template>

<script>
export default {};
</script>

to add a calendar.

VueLocalStorage

VueLocalStorage is a Vue plugin that lets us handle local storage in Vue apps.

To install it, we run:

npm i vue-localstorage

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import VueLocalStorage from "vue-localstorage";

Vue.use(VueLocalStorage);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div id="app">
  </div>
</template>

<script>
export default {
  mounted() {
    this.$localStorage.set('foo', 'bar')
  }
};
</script>

We register the plugin.

Then we can manipulate the local storage with the this.$localStorage property.

We can call get to get a value:

this.$localStorage.get('foo')

To remove an entry, we call remove :

this.$localStorage.remove('foo')

vue-loading-overlay

vue-loading-overlay provides us with an overlay that displays when something loads.

To install it, we run:

npm i vue-loading-overlay

Then we can use it by writing:

<template>
  <div>
    <loading active can-cancel :on-cancel="onCancel" is-full-page></loading>
  </div>
</template>

<script>
import Loading from "vue-loading-overlay";
import "vue-loading-overlay/dist/vue-loading.css";

export default {
  components: {
    Loading
  },
  methods: {
    onCancel() {}
  }
};
</script>

We use the loading component to add an overlay to show when data is loading.

active is a prop that’s set to true if we want to show the overlay.

can-cancel makes the overlay cancelable.

Then when we cancel the onCancel method is called because we set that as the value of the on-cancel prop.

We can also use it as a plugin.

For instance, we can write:

main.js

import Vue from "vue";
import App from "./App.vue";
import Loading from "vue-loading-overlay";
import "vue-loading-overlay/dist/vue-loading.css";

Vue.use(Loading);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div ref="container"></div>
</template>

<script>
export default {
  mounted() {
    this.$loading.show({
      container: this.$refs.container,
      canCancel: true,
      onCancel: this.onCancel
    });
  },
  methods: {
    onCancel() {}
  }
};
</script>

We access the this.$loading.show method to show the overlay.

The container property has is set to the ref of the container we want the overlay to be in so that it’ll be rendered.

onCancel has the method to call when it’s canceled.

Conclusion

vue-fullcalendar is a calendar and date picker component.

vue-loading-overlay is an overlay component that’s used when we load data.

VueLocalStorage is a plugin for handling local storage in Vue apps.

Categories
Top Vue Packages

Top Vue Packages for Adding Tabs, Popovers, Charts, and Display Code with

Vue.js is an easy to use web app framework that we can use to develop interactive front end apps. In this article, we’ll look at the best packages for adding tabs, popovers, charts, and display code with syntax highlighting.

vue-tabs-component

vue-tabs-component is a component that lets us add tabs to our Vue app.

To use it, we run:

npm i vue-tabs-component

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import { Tabs, Tab } from "vue-tabs-component";

Vue.component("tabs", Tabs);
Vue.component("tab", Tab);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div id="app">
    <tabs :options="{ useUrlFragment: false }" @clicked="tabClicked" @changed="tabChanged">
      <tab name="First tab">tab 1</tab>
      <tab name="Second tab">tab 2</tab>
      <tab name="Disabled tab" :is-disabled="true">disabled</tab>
      <tab name="Custom fragment">fragment</tab>
    </tabs>
  </div>
</template>

<script>
export default {
  methods: {
    tabClicked(e) {
      console.log(e);
    },
    tabChanged(e) {
      console.log(e);
    }
  }
};
</script>

We used the tab and tabs components to add the tabs. The name prop is displayed as the link names. And the content between the tab tags is the tab content.

vue-prism-component

vue-prism-component is a component to let us display code with syntax highlighting.

To use it, we run:

npm i vue-prism-component prismjs

to install the packages.

Prism is a required dependency since the component uses it.

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import "prismjs";
import "prismjs/themes/prism.css";
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <prism language="javascript">{{ code }}</prism>
</template>

<script>
import Prism from "vue-prism-component";

export default {
  data() {
    return {
      code: "const a = b"
    };
  },
  components: {
    Prism
  }
};
</script>

We have the prism component and we set the language of the code we’re displaying with the language prop. Then we display the code in between the tags.

vue-js-popover

vue-js-popover lets us add a popover to our Vue app.

We can use it by running:

npm i vue-js-popover

to install it.

Then we can write:

main.js

import Vue from "vue";
import App from "./App.vue";
import Popover from "vue-js-popover";

Vue.use(Popover);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div id="app">
    <button v-popover:foo>Toggle popover</button>

    <popover name="foo">Hello</popover>
  </div>
</template>
<script>
export default {};
</script>

We have the popover component to display a popover.

The name is used as a modifier in the v-popover directive to trigger it.

It’s triggered the button with the v-popover directive.

We change the position and toggle on and off the pointer.

For instance, we can write:

<template>
  <div id="app">
    <button v-popover:foo.right>Toggle popover</button>

    <popover name="foo">Hello</popover>
  </div>
</template>
<script>
export default {};
</script>

We use the right modifier to place the popover on the right.

vue-echarts-v3

vue-echarts-v3 is a chart library for Vue apps. It has support for many kinds of charts.

To use it, we run:

npm install --save echarts vue-echarts-v3

to install it.

Then we write:

<template>
  <div class="echarts">
    <IEcharts :option="bar" :loading="loading" @ready="onReady" @click="onClick"/>
  </div>
</template>

<script type="text/babel">
import IEcharts from "vue-echarts-v3";
export default {
  name: "view",
  components: {
    IEcharts
  },
  props: {},
  data () {
    return {
      loading: false,
      bar: {
        title: {
          text: "fruits"
        },
        tooltip: {},
        xAxis: {
          data: [
            "apple",
            "orange",
            "banana",
          ]
        },
        yAxis: {},
        series: [
          {
            name: "Sales",
            type: "bar",
            data: [5, 20, 36]
          }
        ]
      }
    }
  },
  methods: {
    onReady(instance, ECharts) {
      console.log(instance, ECharts);
    },
    onClick(event, instance, ECharts) {
      console.log(arguments);
    }
  }
};
</script>

<style scoped>
.echarts {
  width: 400px;
  height: 400px;
}
</style>

to create a chart.

The options prop lets us populate the data and labels for our graph.

title has the text prop which has the title.

xAxis has the x-axis labels.

series has the y-axis data.

type has the graph type.

We set the height and width of the graph with CSS.

When we click on the bars on the graph, onClick is run.

It has the data on the bar.

onReady is run when the graph loads.

Conclusion

vue-echarts-v3 is an easy to use chart library for Vue apps. vue-tabs-component lets us add tabs to our app. vue-prism-component is a component to let us display code with syntax highlighting. vue-js-popover is a handy popover component.

Categories
Top Vue Packages

Top Vue Packages for Dropdown, Date Pickers and Popups

Vue.js is an easy to use web app framework that we can use to develop interactive front end apps.

In this article, we’ll look at how the best packages for adding a dropdown with hierarchical selections, popups, and an auto-suggest input.

vue-treeselect

vue-treeselect provides us with a dropdown that’s hierarchical that we can use in our Vue app.

To use it, first we install it by running:

npm i @riophae/vue-treeselect

Then we can use it by writing:

<template>
  <div id="app">
    <treeselect v-model="value" multiple :options="options"/>
  </div>
</template>

<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  components: { Treeselect },
  data() {
    return {
      value: null,
      options: [
        {
          id: 1,
          label: "a",
          children: [
            {
              id: 2,
              label: "foo"
            },
            {
              id: 3,
              label: "bar"
            }
          ]
        },
        {
          id: 4,
          label: "baz"
        },
        {
          id: 5,
          label: "qux"
        }
      ]
    };
  }
};
</script>

We have an options array that have all the options.

They can be nested with the children property.

This way, we’ll see them listed in the dropdown choices.

multiple enables multiple selections.

We’ve to remember to set the id to our choice.

vue-popperjs

vue-popperjs is a pop-up component for add tooltips to elements.

To use it, we first install it by running:

npm i vue-popperjs

Then we can use it by writing:

<template>
  <popper
    trigger="clickToOpen"
    :options="{
      placement: 'top',
      modifiers: { offset: { offset: '0,10px' } }
    }"
  >
    <div class="popper">Popper</div>

<button slot="reference">click me</button>
  </popper>
</template>

<script>
import Popper from "vue-popperjs";
import "vue-popperjs/dist/vue-popper.css";

export default {
  components: {
    popper: Popper
  }
};
</script>

We use the popper component.

We set the trigger to clickToOpen to open the popup on click.

Vue FlatPickr Component

Vue FlatPickr Component is a date-time picker component.

To install it, we run:

npm i vue-flatpickr-component

Then we can use it by writing:

<template>
  <div>
    <flat-pickr v-model="date"></flat-pickr>
    <p>{{date}}</p>
    <p></p>
  </div>
</template>

<script>
import flatPickr from "vue-flatpickr-component";
import "flatpickr/dist/flatpickr.css";

export default {
  data() {
    return {
      date: null
    };
  },
  components: {
    flatPickr
  }
};
</script>

We use the flat-pickr component and bind the selected value to the date state.

flat-pickr will display a date-time picker.

We can also customize it with our own config.

For instance, we can write:

<template>
  <div>
    <flat-pickr v-model="date" :config="config"></flat-pickr>
    <p>{{date}}</p>
    <p></p>
  </div>
</template>

<script>
import flatPickr from "vue-flatpickr-component";
import "flatpickr/dist/flatpickr.css";
import { French } from "flatpickr/dist/l10n/fr.js";

export default {
  data() {
    return {
      date: null,
      config: {
        wrap: true,
        altFormat: "M j, Y",
        altInput: true,
        dateFormat: "Y-m-d",
        locale: French
      }
    };
  },
  components: {
    flatPickr
  }
};
</script>

We change the altFormat to set the date format.

dateFormat is the selected date format.

locale sets the locale.

wrap wraps the input.

vue-bootstrap-datetimepicker

Vue Bootstrap 4 DatetimePicker is a date-time picker that we can use.

To install it, we run:

npm i vue-bootstrap-datetimepicker

We then use the component by writing:

<template>
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <date-picker v-model="date" :config="options"></date-picker>
        <p>{{date}}</p>
      </div>
    </div>
  </div>
</template>

<script>
import "bootstrap/dist/css/bootstrap.css";
import datePicker from "vue-bootstrap-datetimepicker";
import "pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css";

export default {
  data() {
    return {
      date: new Date(),
      options: {
        format: "DD/MM/YYYY",
        useCurrent: false
      }
    };
  },
  components: {
    datePicker
  }
};
</script>

We use the date-picker component to add our date picker input.

v-model binds the selected date to the date variable.

options lets us add the options.

And we’ve to import the CSS to make it look right.

It uses Bootstrap’s style to style the date picker.

vue-autosuggest

vue-autosuggest is an input component that gives us suggestions of what to enter.

To use it, first we install it by running:

npm i vue-autosuggest

Then we use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import VueAutosuggest from "vue-autosuggest";
Vue.use(VueAutosuggest);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div class="container">
    <vue-autosuggest
      :suggestions="[{data:['apple', 'orange' ,'grape']}]"
      :input-props="{id:'autosuggest', placeholder:`What's your favorite fruit?`}"
    >
      <template slot-scope="{suggestion}">
        <span class="my-suggestion-item">{{suggestion.item}}</span>
      </template>
    </vue-autosuggest>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  }
};
</script>

We add the input with the vue-autosuggest component.

Then we populate the default slot to display the choices our way.

Conclusion

vue-treeselect lets us add a dropdown with the with hierarchical selections.

vue-popperjs lets us add popups.

vue-bootstrap-datetimepicker is a simple date picker that uses Bootstrap styles.

vue-autosuggest is a autosuggestion input that we can use simply.

Categories
Top Vue Packages

Top Vue Packages for Adding Charts, Counting Text, Creating UUID, and File Upload

Vue.js is an easy to use web app framework that we can use to develop interactive front end apps. In this article, we’ll look at how the best packages for adding charts, counting text, creating UUIDs, and adding file upload.

Vue-ECharts

Vue-ECharts is an easy to use chart component for Vue apps.

To install it, we can run:

npm i vue-echarts echarts echarts-gl

echarts and echarts-gl are dependencies.

Then we can write:

main.js

import Vue from "vue";
import App from "./App.vue";
import ECharts from "vue-echarts";
import "echarts/lib/chart/bar";
import "echarts/lib/component/tooltip";
import "echarts-gl";

Vue.component("v-chart", ECharts);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <v-chart :options="polar"/>
</template>

<script>
import ECharts from 'vue-echarts'
import 'echarts/lib/chart/line'
import 'echarts/lib/component/polar'

export default {
  components: {
    'v-chart': ECharts
  },
  data () {
    const data = Array(10).fill().map((_, i)=> (i / 10)*Math.PI*180)

    return {
      polar: {
        title: {
          text: 'chart'
        },
        legend: {
          data: ['line']
        },
        polar: {
          center: ['50%', '54%']
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross'
          }
        },
        angleAxis: {
          type: 'value',
          startAngle: 0
        },
        radiusAxis: {
          min: 0
        },
        series: [
          {
            coordinateSystem: 'polar',
            name: 'line',
            type: 'line',
            showSymbol: false,
            data
          }
        ],
        animationDuration: 2000
      }
    }
  }
}
</script>

We created a polar chart with some numerical values.

Then we use the v-chart component to display the chart.

We use polar coordinates and enable animation by setting animationDuration which is measured in milliseconds.

legend sets the legend and it’s displayed on top.

data has in theseries property has the data for the graph.

vue-upload-component

vue-upload-component is a useful upload component for Vue apps.

We can install it by running:

npm i vue-upload-component

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
const VueUploadComponent = require("vue-upload-component");
Vue.component("file-upload", VueUploadComponent);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div>
    <file-upload
      ref="upload"
      v-model="files"
      post-action="/post.method"
      put-action="/put.method"
      @input-file="inputFile"
      @input-filter="inputFilter"
    >
      Upload file
    </file-upload>
    <p>{{files}}</p>
  </div>
</template>

<script>

export default {
  methods: {
    inputFile(){},
    inputFilter(){}
  },
  data() {
    return {
      files: undefined
    }
  }
}
</script>

We use the file-upload component.

v-model binds to the files state.

post-action is the URL to submit the file.

put-action is the URL to submit the file.

input-file and input-filter are emitted by file-upload .

inpit-file is emitted when a file is selected.

vue2-touch-events

vue2-touch-events lets us detect touch events in Vue apps.

To install it, we run:

npm i vue2-touch-events

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import Vue2TouchEvents from "vue2-touch-events";

Vue.use(Vue2TouchEvents);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div>
    <span v-touch:tap="touchHandler">Tap Me</span>
  </div>
</template>

<script>
export default {
  methods: {
    touchHandler() {
      console.log('tapped')
    }
  }
};
</script>

We use the v-touch directive to detect touches of the span.

The directive has many modifiers.

For instance, longtap detects long tap, swipe detects swipe, v-touch-options lets us set options with classes, swipe tolerance, and other things.

v-touch-class lets us set CSS classes for styling.

vue-uuid

Vue UUID lets us add a UUID to a Vue instance.

To install it, we run:

npm i vue-uuid

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import UUID from "vue-uuid";

Vue.use(UUID);
Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div>
    <div>{{ $uuid.v1() }}</div>
    <div>{{ $uuid.v4() }}</div>
  </div>
</template>

<script>
export default {};
</script>

We used the built-in methods to generate UUIDs.

vue-countable

vue-countable will count various quantities in a string like the number of paragraphs, sentences, words, and everything together.

To use it, we run:

npm i vue-countable

Then we can use it by writing:

main.js

import Vue from "vue";
import App from "./App.vue";
import VueCountable from "vue-countable";
Vue.component("vue-countable", VueCountable);

Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

App.vue

<template>
  <div>
    <vue-countable :text="myText" :elementId="'id'" @change="change"></vue-countable>
  </div>
</template>

<script>
export default {
  data() {
    return {
      myText: "foo"
    };
  },
  methods: {
    change(event) {
      console.log(event);
    }
  }
};
</script>

The vue-countable component will count the items.

It emits the change event when the text prop changes.

We set the text prop with the text we want to get the counts of.

Then event object has something like:

{
  all: 3,
  characters: 3,
  paragraphs: 1,
  sentences: 1,
  words: 1
}

Conclusion

Vue-ECharts lets us create charts. vue-upload-component lets us add file upload inputs without hassle. vue-countable counts quantities in strings automatically. vue-uuid generates UUID for us automatically.