[Vuejs]-How to import lodash single function and use on Vue.js template?

0๐Ÿ‘

โœ…

I think your options are either to pass the function through data:

export default {
    data () {
        return { 
            isEmpty: isEmpty,
            example: "Some text",
        }
    }
}

or to make a computed property:

<span v-if="!exampleTextEmpty">{{example}}</span>

// ...

export default {
    data () {
        return { example: "Some text" }
    },
    computed: {
        exampleTextEmpty() {
            return isEmpty(this.example);
        }
    }
}

Leave a comment