init
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { AppContext, App } from "vue";
|
||||
import LayLayer from "./component/index.vue";
|
||||
import { InstallOptions } from "./types";
|
||||
declare const layer: {
|
||||
_context: AppContext | null;
|
||||
open: (option: any, callback?: Function) => string;
|
||||
drawer: (option: any, callback?: Function) => string;
|
||||
msg: (message: string, option?: any, callback?: Function) => string;
|
||||
load: (load: number, option?: any, callback?: Function) => string;
|
||||
confirm: (msg: string, option?: any, callback?: Function) => string;
|
||||
photos: (option: any, callback?: Function) => string;
|
||||
notifiy: (option?: any, callback?: Function) => string;
|
||||
create: (option: any, defaultOption: any, callback?: Function) => string;
|
||||
close: (id: any) => void;
|
||||
closeAll: () => void;
|
||||
reset: (instance: any) => void;
|
||||
};
|
||||
export { layer, LayLayer };
|
||||
declare const _default: {
|
||||
install: (app: App<any>, options?: InstallOptions | undefined) => void;
|
||||
};
|
||||
export default _default;
|
||||
import "./theme/index.css";
|
||||
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString } from "vue";
|
||||
const _hoisted_1 = { class: "layui-timeline-item" };
|
||||
const _hoisted_2 = { class: "layui-icon layui-timeline-axis" };
|
||||
const _hoisted_3 = { class: "layui-timeline-content layui-text" };
|
||||
const _hoisted_4 = {
|
||||
key: 0,
|
||||
class: "layui-timeline-title"
|
||||
};
|
||||
const _hoisted_5 = {
|
||||
key: 1,
|
||||
class: "layui-timeline-title"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayTimelineItem"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
title: null,
|
||||
simple: { type: Boolean }
|
||||
},
|
||||
setup(__props) {
|
||||
useSlots();
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("li", _hoisted_1, [
|
||||
createElementVNode("i", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "dot", {}, () => [
|
||||
createTextVNode("\uE63F")
|
||||
])
|
||||
]),
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
__props.simple ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
||||
renderSlot(_ctx.$slots, "title", {}, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
])
|
||||
])) : (openBlock(), createElementBlock("h3", _hoisted_5, [
|
||||
renderSlot(_ctx.$slots, "title", {}, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
])
|
||||
])),
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
])
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
const iconfonts = require("./iconfont.ts");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const allTemplate = require("./template.ts");
|
||||
|
||||
const resolve = (...file) =>
|
||||
path.resolve(process.cwd() + "/src/icons/", ...file);
|
||||
|
||||
function generateFile(path, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(path, data, "utf8", (err) => {
|
||||
if (err) {
|
||||
console.log(err.message);
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function firstToUpper(str) {
|
||||
var arr = str.split("-");
|
||||
for (var i = 1; i < arr.length; i++) {
|
||||
arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].substring(1);
|
||||
}
|
||||
return arr.join("").trim().replace(str[0], str[0].toUpperCase());
|
||||
}
|
||||
|
||||
let names = [];
|
||||
|
||||
// generate iconfont component
|
||||
const generateIcons = () => {
|
||||
iconfonts.forEach(async (item) => {
|
||||
let className = item.class;
|
||||
let name = firstToUpper(className.replace("layui-icon-", "")) + "Icon";
|
||||
let selectTemplate = allTemplate["Component"];
|
||||
let path = resolve(name + ".vue");
|
||||
let data = { name: name, class: className };
|
||||
names.push(name);
|
||||
await generateFile(path, selectTemplate(data));
|
||||
});
|
||||
};
|
||||
|
||||
// generate icons index.ts
|
||||
const generateIndex = async () => {
|
||||
let path = resolve("index.ts");
|
||||
let selectTemplate = allTemplate["Index"];
|
||||
await generateFile(path, selectTemplate(names));
|
||||
};
|
||||
|
||||
generateIcons();
|
||||
generateIndex();
|
||||
|
||||
console.log("Generate Success");
|
||||
Reference in New Issue
Block a user