Buat project
Mulai dengan membuat project Astro baru:
pnpm create astro@latest astro-app --template with-tailwindcss --install --add vue --gitSunting file tsconfig.json
Tambahkan kode berikut ke tsconfig.json supaya path bisa diselesaikan dengan benar:
json
{
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
}
// ...
}
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Jalankan CLI
Jalankan perintah init untuk menyiapkan project Anda:
pnpm dlx shadcn-vue@latest initTambahkan komponen
Sekarang Anda bisa mulai menambahkan komponen ke project.
pnpm dlx shadcn-vue@latest add buttonPerintah di atas menambahkan komponen Button ke project Anda. Setelah itu, import seperti ini:
astro
---
import { Button } from "@/components/ui/button"
---
<html lang="en">
<head>
<title>Astro</title>
</head>
<body>
<Button>Hello World</Button>
</body>
</html>1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12