antoniputra antoniputra - 1 year ago 596
Javascript Question

Using lodash in all of vue component template

Can I using lodash

in all of my vue component?

for example:

I have components organized like below:


I would like to all of my component can access
lodash without defined in every component vm


I am also trying using Mixins. it works. but the result not expected like this
instead of

Answer Source

You could import the lodash into each component:

  import _ from 'lodash'

  export default {
    methods: {
      test (value) {
        return _.isEmpty(value)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download