-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
133 lines (118 loc) · 3.48 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<script setup lang="ts">
import {useAsciiArt} from '~/composables/useAsciiArt';
import StyleSelector from '~/components/StyleSelector.vue';
// 添加 SEO 信息
useHead({
title: 'ASCII Art Generator - Transform Text into ASCII Art',
meta: [
{
name: 'description',
content: 'Create beautiful ASCII art from text with multiple styles. A fun and creative way to transform your messages into pixel-perfect ASCII artwork.'
},
{
name: 'keywords',
content: 'ASCII art, text to ASCII, ASCII generator, pixel art, text art, ASCII converter'
}
]
})
const {
styles,
inputText,
selectedStyle,
sceneText,
completion,
isLoading,
generateText,
copyToClipboard
} = useAsciiArt()
</script>
<template>
<div class="min-h-screen p-4 transition-colors">
<div class="max-w-4xl mx-auto">
<Navbar/>
<div class="space-y-8">
<!-- 风格选择 -->
<StyleSelector
v-model="selectedStyle"
:styles="styles"
/>
<!-- 输入区域 -->
<div class="space-y-4">
<h2 class="text-2xl font-bold flex items-center gap-2">
<span class="text-2xl">🎬️</span>
场景描述
</h2>
<!-- 添加场景输入框 -->
<div class="nes-field">
<input
v-model="sceneText"
type="text"
id="scene_field"
class="nes-input"
placeholder="描述一下场景,比如:办公室、游戏世界、学校教室... (◕‿◕✿)"
>
</div>
<h2 class="text-2xl font-bold flex items-center gap-2">
<span class="text-2xl">✏️</span>
输入你想说的话
</h2>
<div class="nes-field">
<textarea
v-model="inputText"
class="nes-textarea"
rows="4"
placeholder="在这里输入你想要变成 ASCII 艺术的文字... (◕‿◕✿)"
></textarea>
</div>
</div>
<!-- 生成按钮 -->
<button
class="w-full nes-btn is-primary"
:class="{'is-disabled': isLoading}"
@click="generateText"
:disabled="isLoading"
>
<span class="flex items-center justify-center gap-2">
<span class="text-xl">{{ isLoading ? '🤖' : '✨' }}</span>
{{ isLoading ? '正在施展魔法...' : '开始生成' }}
</span>
</button>
<!-- 生成结果 -->
<div v-if="completion" class="space-y-4">
<h2 class="text-2xl font-bold flex items-center gap-2">
<span class="text-2xl">🎉</span>
生成结果
</h2>
<div class="p-4 nes-container">
<pre class="whitespace-pre-wrap">{{ completion }}</pre>
</div>
<button
class="w-full nes-btn is-success"
@click="copyToClipboard"
>
<span class="flex items-center justify-center gap-2">
<span class="text-xl">📋</span>
复制结果
</span>
</button>
</div>
</div>
<Footer/>
</div>
</div>
</template>
<style scoped>
.nes-container {
margin: 0 !important;
}
.nes-container.is-dark::before {
box-sizing: border-box;
}
.nes-container.is-rounded::before {
box-sizing: border-box;
}
/* 修复禁用按钮的阴影问题 */
.nes-btn.is-disabled {
box-shadow: none !important;
}
</style>