-
-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
affects: @varlet/cli, @varlet/icons, @varlet/ui
- Loading branch information
Showing
10 changed files
with
155 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
var commander_1 = require('commander') | ||
var dev_1 = require('./commands/dev') | ||
var build_1 = require('./commands/build') | ||
var compile_1 = require('./commands/compile') | ||
var create_1 = require('./commands/create') | ||
var jest_1 = require('./commands/jest') | ||
commander_1.command('dev').description('Run varlet development environment').action(dev_1.dev) | ||
commander_1.command('build').description('Build varlet site for production').action(build_1.build) | ||
commander_1 | ||
.command('compile') | ||
.description('Compile varlet components library code') | ||
.option('-w, --watch', 'Watch files change auto compile') | ||
.action(compile_1.compile) | ||
commander_1.command('create <name>').description('Create a component directory').action(create_1.create) | ||
commander_1 | ||
.command('jest') | ||
.option('-c, --component [componentName]', 'Run Jest in component directory') | ||
.description('Run Jest in work directory') | ||
.action(jest_1.jest) | ||
commander_1.parse() | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var commander_1 = require("commander"); | ||
var dev_1 = require("./commands/dev"); | ||
var build_1 = require("./commands/build"); | ||
var compile_1 = require("./commands/compile"); | ||
var create_1 = require("./commands/create"); | ||
var jest_1 = require("./commands/jest"); | ||
commander_1.command('dev') | ||
.description('Run varlet development environment') | ||
.action(dev_1.dev); | ||
commander_1.command('build') | ||
.description('Build varlet site for production') | ||
.action(build_1.build); | ||
commander_1.command('compile') | ||
.description('Compile varlet components library code') | ||
.option('-w, --watch', 'Watch files change auto compile') | ||
.action(compile_1.compile); | ||
commander_1.command('create <name>') | ||
.description('Create a component directory') | ||
.action(create_1.create); | ||
commander_1.command('jest') | ||
.option('-c, --component [componentName]', 'Run Jest in component directory') | ||
.description('Run Jest in work directory') | ||
.action(jest_1.jest); | ||
commander_1.parse(); |
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
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,49 +1,85 @@ | ||
<template> | ||
<var-icon :name="name" :transition="transition" color="red" size="30px" /> | ||
<div class="example"> | ||
<app-type>icons列表</app-type> | ||
<div class="example__icons"> | ||
<div | ||
class="example__icon" | ||
v-for="iconName in iconNames" | ||
:key="iconName" | ||
v-ripple | ||
:data-clipboard-text="iconName" | ||
> | ||
<var-icon :name="iconName" /> | ||
<div class="example__icon-name"> | ||
{{ iconName }} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<var-button @click="toggle">toggle</var-button> | ||
<var-button @click="toggleTransition">toggle transition</var-button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, ref, Ref } from 'vue' | ||
import { defineComponent, reactive, onMounted } from 'vue' | ||
import Icon from '..' | ||
import Button from '../../button' | ||
import Ripple from '../../ripple' | ||
import Snackbar from '../../snackbar' | ||
const Clipboard = require('clipboard') | ||
export default defineComponent({ | ||
name: 'IconExample', | ||
components: { | ||
[Icon.name]: Icon, | ||
[Button.name]: Button, | ||
}, | ||
setup() { | ||
const name: Ref<string> = ref('checkbox-marked-circle') | ||
const show: Ref<boolean> = ref(true) | ||
const transition: Ref<number> = ref(0) | ||
return { | ||
name, | ||
show, | ||
transition, | ||
toggleTransition() { | ||
transition.value = 300 | ||
name.value = name.value === 'checkbox-marked-circle' ? 'information-outline' : 'checkbox-marked-circle' | ||
}, | ||
toggle() { | ||
transition.value = 0 | ||
name.value = name.value === 'checkbox-marked-circle' ? 'information-outline' : 'checkbox-marked-circle' | ||
}, | ||
} | ||
}, | ||
name: 'IconExample', | ||
components: { | ||
[Icon.name]: Icon, | ||
[Button.name]: Button | ||
}, | ||
directives: { Ripple }, | ||
setup() { | ||
const iconNames: string[] = reactive(require('@varlet/icons')) | ||
onMounted(() => { | ||
const clipboard = new Clipboard('.example__icon', { | ||
text(trigger) { | ||
const iconName = trigger.getAttribute('data-clipboard-text') | ||
return `<var-icon name="${iconName}" />` | ||
} | ||
}) | ||
clipboard.on('success', (e: any) => { | ||
Snackbar.success(`成功完成复制${e.text}`) | ||
}) | ||
}) | ||
return { | ||
iconNames | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
<style lang="less" scoped> | ||
.example { | ||
background: antiquewhite; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
&__icons { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
&__icon { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 33%; | ||
padding: 10px; | ||
} | ||
&__icon-name { | ||
font-size: 12px; | ||
text-align: center; | ||
} | ||
} | ||
</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