!84 部分优化

Merge pull request !84 from 就眠儀式/master
This commit is contained in:
就眠儀式 2022-06-24 02:12:29 +00:00 committed by Gitee
commit 553b1210ad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 21 additions and 45 deletions

View File

@ -34,8 +34,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { layer } from "@layui/layer-vue"; import { layer } from "@layui/layer-vue";
import { onMounted, onUnmounted, ref, watch } from "vue"; import { onMounted, onUnmounted, ref, watch } from "vue";
import { usePlayGround } from "../composable/usePlayground";
import { usePlayGround } from "../plugin/usePlayground";
const meta = ref<HTMLElement>({} as HTMLElement); const meta = ref<HTMLElement>({} as HTMLElement);
const isFixContorl = ref(false); const isFixContorl = ref(false);

View File

@ -1,17 +1,17 @@
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import Markdown from "vite-plugin-md"; import Markdown from "vite-plugin-md";
import container from "markdown-it-container"; import container from "markdown-it-container";
import preWrapper from "./pre-wrapper";
import highlight from "./highlight"; import highlight from "./highlight";
import snippet from "./snippet"; import snippet from "./snippet";
import demo from "./demo"; import demo from "./create-demo";
import createTitle from "./create-title"; import createTitle from "./create-title";
import createQuote from "./create-quote"; import createQuote from "./create-quote";
import createDescribe from "./create-describe"; import createDescribe from "./create-describe";
import createTable from "./create-table"; import createTable from "./create-table";
import createAnchor from "./create-anchor"; import createAnchor from "./create-anchor";
import preWrapper from "./pre-wrapper"; import createPreviousNext from "./create-previous-next";
import previousNext from "./previous-next"; import createContributor from "./create-contributor";
import contributor from "./contributor";
const plugins = [ const plugins = [
vue({ vue({
@ -28,13 +28,13 @@ const plugins = [
md.use(snippet) md.use(snippet)
.use(preWrapper) .use(preWrapper)
.use(container, "demo", demo) .use(container, "demo", demo)
.use(...createTable("table", "")) .use(...createTable("table"))
.use(...createQuote("quote", "")) .use(...createQuote("quote"))
.use(...createTitle("title", "")) .use(...createTitle("title"))
.use(...createDescribe("describe", "")) .use(...createDescribe("describe"))
.use(...createAnchor("anchor", "")) .use(...createAnchor("anchor"))
.use(...previousNext("previousNext", "")) .use(...createPreviousNext("previousNext"))
.use(...contributor("contributor", "")); .use(...createContributor("contributor"));
}, },
}), }),
] as any; ] as any;

View File

@ -7,10 +7,7 @@ type ContainerArgs = [
{ render(tokens: Token[], idx: number): string } { render(tokens: Token[], idx: number): string }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -9,10 +9,7 @@ type ContainerArgs = [
} }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -7,10 +7,7 @@ type ContainerArgs = [
{ render(tokens: Token[], idx: number): string } { render(tokens: Token[], idx: number): string }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -9,10 +9,7 @@ type ContainerArgs = [
} }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -7,10 +7,7 @@ type ContainerArgs = [
{ render(tokens: Token[], idx: number): string } { render(tokens: Token[], idx: number): string }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -7,10 +7,7 @@ type ContainerArgs = [
{ render(tokens: Token[], idx: number): string } { render(tokens: Token[], idx: number): string }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,

View File

@ -7,10 +7,7 @@ type ContainerArgs = [
{ render(tokens: Token[], idx: number): string } { render(tokens: Token[], idx: number): string }
]; ];
export default function createContainer( export default function createContainer(klass: string): ContainerArgs {
klass: string,
defaultTitle: string
): ContainerArgs {
return [ return [
container, container,
klass, klass,
@ -19,9 +16,7 @@ export default function createContainer(
const token = tokens[idx]; const token = tokens[idx];
const info = token.info.trim().slice(klass.length).trim(); const info = token.info.trim().slice(klass.length).trim();
if (token.nesting === 1) { if (token.nesting === 1) {
return `<lay-field id="${info || defaultTitle}" title="${ return `<lay-field id="${info}" title="${info}" style="margin-top:21px;margin-bottom: 20px;">`;
info || defaultTitle
}" style="margin-top:21px;margin-bottom: 20px;">`;
} else { } else {
return "</lay-field>\n"; return "</lay-field>\n";
} }

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import plugins from "./src/plugin/common-plugins"; import plugins from "./src/plugin/all-plugins";
export default defineConfig({ export default defineConfig({
resolve: { resolve: {