버튼, 라디오, 콤보박스 추가

This commit is contained in:
daniel LEE 2024-11-02 14:08:45 +09:00
parent fef00a2a88
commit 05c39ed977
6 changed files with 67 additions and 39 deletions

View File

@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/vue" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -1,5 +1,34 @@
<template> <template>
<div id="app"> <div id="app">
<div>
<h1>Ant Design Button Demo</h1>
<a-button type="primary" @click="handleClick">Click Me</a-button>
</div>
<div>
<h1>타입 선택</h1>
<div class="select-container">
<a-select v-model:value="selectedOption" placeholder="옵션을 선택하세요" style="width: 200px">
<a-select-option value="option1">옵션 1</a-select-option>
<a-select-option value="option2">옵션 2</a-select-option>
<a-select-option value="option3">옵션 3</a-select-option>
</a-select>
<br>
<p>선택한 옵션: {{ selectedOption }}</p>
</div>
</div>
<div>
<h2>옵션 선택</h2>
<a-radio-group v-model:value="radioOption">
<a-radio value="option1">옵션 1</a-radio>
<a-radio value="option2">옵션 2</a-radio>
<a-radio value="option3">옵션 3</a-radio>
</a-radio-group>
<br><br>
<p>선택한 옵션: {{ radioOption }}</p>
</div>
<h1>사용자 목록</h1> <h1>사용자 목록</h1>
<!-- 데이터가 로드되면 목록을 출력하고, 로드되지 않았으면 로딩 메시지를 표시 --> <!-- 데이터가 로드되면 목록을 출력하고, 로드되지 않았으면 로딩 메시지를 표시 -->
<ul v-if="users.length"> <ul v-if="users.length">
@ -11,14 +40,18 @@
</div> </div>
</template> </template>
<script> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import axios from 'axios'; // axios import axios from 'axios';
import { Button } from 'ant-design-vue';
export default { const users = ref([]);
name: 'App', const selectedOption = ref('');
setup() { const radioOption = ref('option1'); //
const users = ref([]); // ref
const handleClick = () => {
alert('Button clicked!');
};
const fetchUsers = async () => { const fetchUsers = async () => {
try { try {
@ -29,25 +62,15 @@ export default {
} }
}; };
// fetchUsers
onMounted(() => { onMounted(() => {
fetchUsers(); fetchUsers();
}); });
return {
users,
};
},
};
</script> </script>
<style> <style scoped>
#app { .select-container {
font-family: Avenir, Helvetica, Arial, sans-serif; display: flex;
-webkit-font-smoothing: antialiased; flex-direction: column;
-moz-osx-font-smoothing: grayscale; margin-top: 20px;
text-align: left;
color: #2c3e50;
margin-top: 60px;
} }
</style> </style>

View File

@ -4,5 +4,8 @@ export default defineNuxtConfig({
devtools: { enabled: true }, devtools: { enabled: true },
plugins: [ plugins: [
'~/plugins/ant-design-vue.js' '~/plugins/ant-design-vue.js'
],
css: [
'ant-design-vue/dist/reset.css'
] ]
}) })

View File

@ -10,6 +10,7 @@
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"
}, },
"dependencies": { "dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"ant-design-vue": "^4.2.5", "ant-design-vue": "^4.2.5",
"axios": "^1.7.7", "axios": "^1.7.7",
"nuxt": "^3.13.2", "nuxt": "^3.13.2",

View File

@ -1,5 +1,7 @@
import Vue from 'vue'; import { defineNuxtPlugin } from '#app';
import Antd from 'ant-design-vue'; import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css'; import 'ant-design-vue/dist/reset.css';
Vue.use(Antd); export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(Antd);
});

View File

@ -22,7 +22,7 @@
resolved "https://registry.yarnpkg.com/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz#ed2be7fb4d82ac7e1d45a54a5b06d6cecf8be6f6" resolved "https://registry.yarnpkg.com/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz#ed2be7fb4d82ac7e1d45a54a5b06d6cecf8be6f6"
integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA== integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==
"@ant-design/icons-vue@^7.0.0": "@ant-design/icons-vue@^7.0.0", "@ant-design/icons-vue@^7.0.1":
version "7.0.1" version "7.0.1"
resolved "https://registry.yarnpkg.com/@ant-design/icons-vue/-/icons-vue-7.0.1.tgz#83de301771fadd03f3890e627314102405c31c22" resolved "https://registry.yarnpkg.com/@ant-design/icons-vue/-/icons-vue-7.0.1.tgz#83de301771fadd03f3890e627314102405c31c22"
integrity sha512-eCqY2unfZK6Fe02AwFlDHLfoyEFreP6rBwAZMIJ1LugmfMiVgwWDYlp1YsRugaPtICYOabV1iWxXdP12u9U43Q== integrity sha512-eCqY2unfZK6Fe02AwFlDHLfoyEFreP6rBwAZMIJ1LugmfMiVgwWDYlp1YsRugaPtICYOabV1iWxXdP12u9U43Q==