Langsung ke konten utama

Cara menggunakan lodash di template vue js

Lodash render didalam tag <template> 

Jika ingin menggunakan di dalam page (bukan global component)


import _startCase from 'lodash/startCase'


<template>
    {{ _startCase('no_access') }}
</template>


methods: {
    _startCase,
}


Jika ingin global template expression component


{{_.camelCase("vue lodash!")}}


import _ from 'lodash';

const VueLodash = {
install(Vue, options) {
Vue.prototype.$_ = _;

Vue.mixin({
mounted() {
// Just tell you that it is mounted
// console.log('VueLodash');
}
});

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VueLodash)
}
}
};

export default VueLodash;

source: link


Komentar

Postingan populer dari blog ini

Install adb on mac os

Delete your old installation (optional)  rm -rf ~/.android-sdk-macosx/ Download  adb   Go folder download  cd Download Unzip file unzip platform-tools-latest*. zip Create and move adb mkdir ~/.android-sdk-macosx mv platform-tools/ ~/.android-sdk-macosx/platform-tools Add platform your path echo 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile Refresh your bash profile (restart terminal) source ~/.bash_profile Start adb devices adb devices

Dreamweaver 8

Dreamweaver Download :  Klik Serial Number :  Klik