layui/package/icons/scripts/template.ts

32 lines
595 B
TypeScript
Raw Normal View History

2022-04-05 10:31:31 +08:00
module.exports = {
Component: (data) => {
return `<script lang="ts">
export default {
name: "${data.name}",
};
</script>
<script setup lang="ts">
import LayIcon from "../component/icon/index";
const props = defineProps<{
color?: string;
size?: string;
}>();
</script>
<template>
<lay-icon
:color="props.color"
:size="props.size"
type="${data.class}"
/>
</template>`;
},
Index: (names) => {
let result = ``;
names.forEach((name) => {
result += `export { default as ${name} } from './${name}.vue';` + "\r\n";
});
return result;
},
};