-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: directives and function component support
- Loading branch information
zhangmo8
authored and
jiahengz
committed
Apr 4, 2023
1 parent
b3028ed
commit a53e534
Showing
12 changed files
with
152 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
<script setup lang="ts"> | ||
const show = ref(false) | ||
// const showSnackBar = () => { | ||
// Snackbar({ | ||
// content: '这是一个消息条!!', | ||
// duration: 1000 | ||
// }) | ||
// } | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<var-button>qfqw</var-button> | ||
<var-skeleton :loading="true"> | ||
<div v-ripple class="ripple-example-block">点击</div> | ||
<!-- <var-skeleton :loading="show"> | ||
加载的数据 | ||
</var-skeleton> | ||
<var-space> | ||
<var-button>Button1</var-button> | ||
<var-button>Button2</var-button> | ||
</var-skeleton> --> | ||
|
||
<!-- <var-button @click="showSnackBar"> | ||
Button2 | ||
</var-button> --> | ||
<!-- <var-space> | ||
<var-button>Button3</var-button> | ||
</var-space> | ||
<var-progress :value="20" :track="false" /> | ||
<var-card | ||
title="本草纲目" | ||
description="如果华佗再世,崇洋都被医治,外邦来学汉字,激发我民族意识。马钱子、决明子、苍耳子,还有莲子;黄药子、苦豆子、川楝子,我要面子。用我的方式,改写一部历史。没什么别的事,跟着我念几个字。山药当归枸杞 GO,山药 当归 枸杞 GO,看我抓一把中药,服下一帖骄傲~" | ||
/> | ||
<var-result type="success" title="Success" description="Hi, I'm a result description."> | ||
<template #footer> | ||
<var-button type="success"> | ||
OK | ||
</var-button> | ||
</template> | ||
</var-result> | ||
</div> | ||
</var-space> --> | ||
<!-- <var-progress :value="20" :track="false" /> | ||
<var-card title="本草纲目" | ||
description="如果华佗再世,崇洋都被医治,外邦来学汉字,激发我民族意识。马钱子、决明子、苍耳子,还有莲子;黄药子、苦豆子、川楝子,我要面子。用我的方式,改写一部历史。没什么别的事,跟着我念几个字。山药当归枸杞 GO,山药 当归 枸杞 GO,看我抓一把中药,服下一帖骄傲~" /> --> | ||
</template> | ||
|
||
<style> | ||
</style> | ||
.ripple-example-block { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100px; | ||
user-select: none; | ||
cursor: pointer; | ||
color: #888; | ||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | ||
transition: background-color 0.25s; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { kebabCase } from '@varlet/shared' | ||
import { moduleName } from '../config' | ||
import type { ModuleOptions } from '../types' | ||
|
||
export function resolveDirectives( | ||
config: ModuleOptions, | ||
name: string | ||
): undefined | [name: string, styles?: string] { | ||
const { directives } = config | ||
|
||
if (directives[name]) { | ||
const [directive, styleName] = Array.isArray(directives[name]) ? directives[name] : [directives[name]] as any | ||
if (styleName) { | ||
return [directive, `${moduleName}/es/${kebabCase(name)}/style`] | ||
} | ||
|
||
return [directive, styleName] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
import { moduleName } from './config' | ||
import { PresetImport } from './types' | ||
|
||
export function genSideEffectsImport (value: string): string { | ||
export function genSideEffectsImport(value: string): string { | ||
return `import '${value}';` | ||
} | ||
|
||
export function genLibraryImport(list: PresetImport[]): string { | ||
const values = list.map((item) => { | ||
if (Array.isArray(item)) { | ||
const [name, as] = item | ||
return `${name} as ${as}` | ||
} | ||
|
||
return item | ||
}) | ||
|
||
return `import {${values.join(',')}} from '${moduleName}';` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters