[improvement] sort out utils (#2672)

This commit is contained in:
neverland
2019-02-02 10:41:01 +08:00
committed by GitHub
parent 0eb06b10a8
commit f0056297c6
9 changed files with 93 additions and 90 deletions

View File

@@ -2,7 +2,16 @@ import useBem from './bem';
import useSfc from './sfc';
import useI18n from './i18n';
export default function (name) {
export function use(name) {
name = 'van-' + name;
return [useSfc(name), useBem(name), useI18n(name)];
}
export function useSlots({ $slots, $scopedSlots }) {
return (name, props) => {
if ($scopedSlots[name]) {
return $scopedSlots[name](props);
}
return $slots[name];
};
}