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

Emulator PS1/ PSX

Emulator PS1/PSX adalah emulator anpa ada pengaturan BIOS karena sudah mencakup BIOS. Aplikasi pengganti Play Station pemutar CD, biasanya berupa file ISO, BIN, IMG, CUE, MDS, MDF. Keunggulannya bisa memainkan dengan joystick, mouse, keyborad. Caranya: - Klik Config - Game pad - Port 1 - Pad 1. Untuk File  Download Disini !!!  atau  Download