5 Most-Requested Features For Vue.js in 2018

Vue is famed for its ease of use and simplicity. It achieves these qualities, in part, by having a focused and small API without too many extraneous features.

Vue is famed for its ease of use and simplicity. It achieves these qualities, in part, by having a focused and small API without too many extraneous features.

That said, users and maintainers are always thinking about potentially useful new features. This article discusses five of the most requested features from Vue's GitHub issue board.

  1. Support for iterable protocol with v-for
  2. Multi-root templates (fragments)
  3. Reactive refs
  4. Custom v-model modifiers
  5. Package for custom renderers

It's good to be aware of these feature requests, as some will make their way into coming versions of Vue, while the ones that don't may help you better understand the design of Vue.

1. Support for iterable protocol with v-for

What is it?

When you think of iteration, you'll most likely think of arrays. ES2015 introduced the iterable protocol which, when implemented, allows for any kind of object to be iterated using for...of. ES2015 also introduced new iterable data types like Map and Set.

Currently, Vue's v-for directive can iterate arrays and plain objects, but not other iterable objects or data types. If you're using a Map, for example, and you want to iterate it with v-for, you'll first have to convert it to an array or plain object.

Note: maps, sets, and other new iterable data types are not reactive, either.

Why do users want it?

Since iterable objects and data types are officially part of the JavaScript language now, it's inevitable that applications will utilize them for the benefits they offer.

If Vue is used as the UI layer for such an application, these objects and data types either can't be iterated in the template or will need to pass through transformation functions.

Will it be added?

Maybe. The issue has been closed on GitHub, as the maintainers weren't convinced that iterable objects and data types would commonly be used for UI state. Also, making iterable objects and data types reactive would take considerable work.

However, Vue's observation system is to be refactored in version 2.x-next, which would be the ideal time to implement this feature.

Read more on GitHub.

2. Multi-root templates (fragments)

What is it?

Currently, Vue has a limitation where templates require a single root node. That means this is valid:

<template> <div/> </template>

But this is not:

<template> <div/> <div/> </template>

Some Vue users are requesting multi-root templates, especially now that the feature has been added to React.

Why do users want it?

If you want your component to render child nodes for some parent element, you'll need to add a wrapper to comply with the single-root restriction:

<template> <div><!--Need to add this wrapper--> <child1/> <child2/> ... </div> </template>

Having a wrapper in the structure will interfere with the requirements of certain HTML or CSS features. For example, if you have a parent element with display: flex, having a wrapper between the parent and children won't work.

<template> <div style="display:flex"> <!--This pattern won't work because of the wrapper:/--> <FlexChildren/> </div> </template>

Will it be added?

According to the maintainers, the way the virtual DOM diffing algorithm works makes this feature difficult to implement and would require a major rewrite. As such, this feature is not on the roadmap for development.

Read more on GitHub.

3. Reactive refs

What is it?

An essential design aspect of Vue components is that they must be isolated and communicate by props and events. However, sometimes you need one component to be able to mutate the state of another. For example, you may want a form component to switch on the focus of a child input component.

The solution is to use refs, which give a component an escape hatch into another component's data model. However, when accessed via refs, the component's data model is not reactive so it can't be watched or included in a computed property. Reactive refs would allow it to be.

Why do users want it?

Components normally communicate through props and events, and only in a parent/child relationship. For a parent component to track a child component's data, the child must emit its state changes via events. This requires the parent to have a listener, a handler, and local data properties for storing the tracked state.

For an example of this, imagine a parent form component tracking the state of a child input's "valid" state:

<template> <form-input @valid="updateValidEmail"> </template <script> export default { data() => ({ emailValid: false }), methods: { updateValidEmail(value) { this.emailValid = value; } } } </script>

This code works fine. The only problem is that every single child input in the form needs similar, unique code. If the form has 10's or 100's of inputs, the form component will become massive.

Using reactive refs, the parent would not need to track the child and could simply watch its state with a computed property, reducing excessive code.

<template> <form-input ref="email"> </template <script> export default { computed: { emailValid() { // Currently this won't work as $refs is not reactive this.$refs.email.isValid; } } } </script>

Will it be added?

While it is a highly requested feature, there are no plans to add it. One concern is that the feature violates good component design. Refs are meant to only be a last resort when the props/events interface can't be used. Making refs reactive would allow for anti-patterns where refs were used instead of events.

Read more on GitHub.

Custom v-model modifiers

What is it?

You can use the v-model directive to create two-way data bindings on form inputs:

<input v-model="message"/> <!--Message automatically updates as the input is used--> <p>Message is: {{ message }}</p> <script> new Vue({ data: { message: null } }); </script>

v-model is syntactic sugar over a prop and event listener.

Several modifiers are available to transform the event. For example, the .number modifier, used like v-model.number="num", will automatically typecast the input as a number. This is useful because even with type="number" on the input, the value returned from HTML input elements is always a string.

This feature request is to allow custom v-model modifiers defined by users.

Why do users want it?

Let's say you wanted to automatically format a Thai phone number as a user typed it into an input, for example, typing "0623457654" would be transformed to "+66 6 2345 7654". You could write a custom modifier, say, .thaiphone, and use it on your input. Easy.

Without this feature, either a computed property needs to be created for each input to perform the transform, or a custom input component needs to be created where the transform logic occurs before the event is emitted. Both of these options work but require additional code that seems easy to avoid.

Will it be added?

Unlikely. This and related issues have been closed by the maintainers who recommend the workarounds just mentioned.

Read more on GitHub.

Package for custom renderers

What is it?

Currently, Vue's renderer is hard-coded for HTML elements, as Vue was initially intended only for use on the web. The idea of this feature is to isolate the HTML renderer from the main Vue package.

Why do users want it?

Vue is now being used in non-web environments e.g. on mobile via projects like NativeScript. Isolating the renderer would make it easy for a library author to replace the HTML renderer with a renderer suitable for their chosen environment.

Vue.use(NonWebRenderer); new Vue({ render(h) => h('non-web-element', { text: 'Hello World' }); });

Will it be added?

Yes! This will be part of a larger change where many Vue internals will be split into separate packages with their own APIs, allowing this and other kinds of Vue custom builds. This change has been added to the Vue.js Roadmap and is slated for version 3.x.

Read more on GitHub.


By : Anthony Gore


10 Best Vue Icon Component For Your Vue.js App

10 Best Vue Icon Component For Your Vue.js App

In this article, I will collect 10 Vue icon component to bring more interactivity, better UI design to your Vue application.

Icons are the vital element of the user interface of the product enabling successful and effective interaction with it. In this article, I will collect 10 Vue icon component to bring more interactivity, better UI design to your Vue application.

1. Animated SweetAlert Icons for Vue

A clean and simple Vue wrapper for SweetAlert's fantastic status icons. This wrapper is intended for users who are interested in just the icons. For the standard SweetAlert modal with all of its bells and whistles, you should probably use Vue-SweetAlert 2

Demo: https://vue-sweetalert-icons.netlify.com/

Download: https://github.com/JorgenVatle/vue-sweetalert-icons/archive/master.zip

2. vue-svg-transition

Create 2-state, SVG-powered animated icons.

Demo: https://codesandbox.io/s/6v20q76xwr

Download: https://github.com/kai-oswald/vue-svg-transition/archive/master.zip

3. Vue-Awesome

Awesome SVG icon component for Vue.js, with built-in Font Awesome icons.

Demo: https://justineo.github.io/vue-awesome/demo/

Download: https://github.com/Justineo/vue-awesome/archive/master.zip

4. vue-transitioning-result-icon

Transitioning Result Icon for Vue.js

A scalable result icon (SVG) that transitions the state change, that is the SVG shape change is transitioned as well as the color. Demonstration can be found here.

A transitioning (color and SVG) result icon (error or success) for Vue.

Demo: https://transitioning-result-icon.dexmo-hq.com/

Download: https://github.com/dexmo007/vue-transitioning-result-icon/archive/master.zip

5. vue-zondicons

Easily add Zondicon icons to your vue web project.

Demo: http://www.zondicons.com/icons.html

Download: https://github.com/TerryMooreII/vue-zondicons/archive/master.zip

6. vicon

Vicon is an simple iconfont componenet for vue.

iconfont
iconfont is a Vector Icon Management & Communication Platform made by Alimama MUX.

Download: https://github.com/Lt0/vicon/archive/master.zip

7. vue-svgicon

A tool to create svg icon components. (vue 2.x)

Demo: https://mmf-fe.github.io/vue-svgicon/v3/

Download: https://github.com/MMF-FE/vue-svgicon/archive/master.zip

8. vue-material-design-icons

This library is a collection of Vue single-file components to render Material Design Icons, sourced from the MaterialDesign project. It also includes some CSS that helps make the scaling of the icons a little easier.

Demo: https://gitlab.com/robcresswell/vue-material-design-icons

Download: https://gitlab.com/robcresswell/vue-material-design-icons/tree/master

9. vue-ionicons

Vue Icon Set Components from Ionic Team

Design Icons, sourced from the Ionicons project.

Demo: https://mazipan.github.io/vue-ionicons/

Download: https://github.com/mazipan/vue-ionicons/archive/master.zip

10. vue-ico

Dead easy, Google Material Icons for Vue.

This package's aim is to get icons into your Vue.js project as quick as possible, at the cost of all the bells and whistles.

Demo: https://material.io/resources/icons/?style=baseline

Download: https://github.com/paulcollett/vue-ico/archive/master.zip

I hope you like them!

Collection of 10 Vue Markdown Component for Vue.js App in 2020

Collection of 10 Vue Markdown Component for Vue.js App in 2020

Markdown is a way to style text on the web. The 10 Vue markdown components below will give you a clear view.

Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown.

The 10 Vue markdown components below will give you a clear view.

1. Vue Showdown

Use showdown as a Vue component.

View Demo

Download Source

2. showdown-markdown-editor

A markdown editor using codemirror and previewer using showdown for Vue.js.

View Demo

Download Source

3. markdown-it-vue

The vue lib for markdown-it.

View Demo

Download Source

4. perfect-markdown

perfect-markdown is a markdown editor based on Vue & markdown-it. The core is inspired by the implementation of mavonEditor, so perfect-markdown has almost all of the functions of mavonEditor. What's more, perfect-markdown also extends some features based on mavonEditor.

View Demo

Download Source

5. v-markdown-editor

Vue.js Markdown Editor component.

View Demo

Download Source

6. markdown-to-vue-loader

Markdown to Vue component loader for Webpack.

View Demo

Download Source

7. fo-markdown-note Component for Vue.js

fo-markdown-note is a Vue.js component that provides a simple Markdown editor that can be included in your Vue.js project.

fo-markdown-note is a thin Vue.js wrapper around the SimpleMDE Markdown editor JavaScript control.

View Demo

Download Source

8. Vue-SimpleMDE

Markdown Editor component for Vue.js. Support both vue1.0 & vue2.0

View Demo

Download Source

9. mavonEditor

A nice vue.js markdown editor. Support WYSIWYG editing mode, reading mode and so on.

View Demo

Download Source

10. vue-markdown

A Powerful and Highspeed Markdown Parser for Vue.

View Demo

Download Source

Thank for read!

Collection of 15 Vue Input Component for Your Vue.js App

Collection of 15 Vue Input Component for Your Vue.js App

Vue input component gives you a baseline to create your own custom inputs. It consists of a prepend/append slot, messages, and a default slot. In this article I will share 15 Vue input components to you.

Vue input component gives you a baseline to create your own custom inputs. It consists of a prepend/append slot, messages, and a default slot. In this article I will share 15 Vue input components to you.

1. Maska
  • No dependencies
  • Small size (~2 Kb gziped)
  • Ability to define custom tokens
  • Supports repeat symbols and dynamic masks
  • Works on any input (custom or native)

Demo

Download


2. v-range-flyout

A vue component that wraps a input type=number with a customizable range slider flyout with 2-way binding.

Demo

Download


3. vue-tel-input

International Telephone Input with Vue.

Demo

Download


4. Restricted Input

Allow restricted character sets in input elements.

Features

  • Disallow arbitrary characters based on patterns
  • Maintains caret position
  • Format/Update on paste
  • Works in IE11+

Demo

Download


5. Vue Currency Input

The Vue Currency Input plugin allows an easy input of currency formatted numbers.

Demo

Download


6. vue-fields

Input components for vue.js.

Demo

Download


7. vue-material-input

Simple example of issue I am seeing with input labels.

Demo

Download


8. vue-tribute

A Vue.js wrapper for Zurb's Tribute library for native @mentions.

Demo

Download


9. vue-number-smarty

Number input with rich functionality for Vue.js.

Features

  • integer/float
  • signed/unsigned
  • step size
  • increment/decrement value by scrolling when focused
  • align variants
  • min and max boundaries
  • max length of integer part (only for float type)
  • max length of float part (only for float type)
  • max length of string
  • error state
  • readonly state
  • theme options

Demo

Download


10. Vue input mask

Super tiny input mask library for vue.js based on PureMask.js (~2kb) exposed as directive. No dependencies.

Demo

Download


11. vue-r-mask

mask directive for vue.js

  • Template similar to javascript regular expression. /\d{2}/
  • Directive useful for your own input or textarea.
  • Arbitrary number of digits in template /\d{1,10}/

Demo

Download


12. Vue IP

An ip address input with port and material design support.

Demo

Download


13. v-money Mask for Vue.js

Tiny input/directive mask for currency

Features

  • Lightweight (<2KB gzipped)
  • Dependency free
  • Mobile support
  • Component or Directive flavors
  • Accept copy/paste
  • Editable

Demo

Download


14. Vue Masked Input

Dead simple masked input component for Vue.js 2.X. Based on inputmask-core.

Demo

Download


15. VueJS input component

Mobile & Desktop friendly VueJS input component
Features used
CSS variables
Vue's transition-group
Flexbox

Demo


I hope you like them!