[bugfix] Icon: should support render local image

This commit is contained in:
陈嘉涵
2019-06-03 20:46:16 +08:00
parent 616db0114e
commit 39339fdda7
5 changed files with 19 additions and 22 deletions
+5 -2
View File
@@ -1,7 +1,6 @@
import { use, suffixPx } from '../utils';
import { inherit } from '../utils/functional';
import Info from '../info';
import { isSrc } from '../utils/validate/src';
// Types
import { CreateElement, RenderContext } from 'vue/types';
@@ -22,13 +21,17 @@ export type IconEvents = {
const [sfc] = use('icon');
function isImage(name?: string): boolean {
return name ? name.indexOf('/') !== -1 : false;
}
function Icon(
h: CreateElement,
props: IconProps,
slots: DefaultSlots,
ctx: RenderContext<IconProps>
) {
const urlIcon = isSrc(props.name);
const urlIcon = isImage(props.name);
return (
<props.tag