@cran/vue.use
Version:
Cranberry Vue Use Utilities
17 lines (16 loc) • 438 B
JavaScript
import { bem } from "../utility/bem";
import { useBid } from "./useBid";
export function useBem(block) {
const bid = useBid(block);
const bemFactory = bem(bid());
return new Proxy(function getBem(m) {
return bemFactory(m);
}, {
get(_target, property) {
if ("string" !== typeof property) {
return;
}
return bemFactory(bid[property]);
},
});
}