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