feat: vue project setup
This commit is contained in:
9
src/App.vue
Normal file
9
src/App.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import AppCounter from "@/components/AppCounter.vue";
|
||||
|
||||
console.log("Ok");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppCounter />
|
||||
</template>
|
||||
11
src/__tests__/App.spec.ts
Normal file
11
src/__tests__/App.spec.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import { mount } from "@vue/test-utils";
|
||||
import App from "../App.vue";
|
||||
|
||||
describe("App", () => {
|
||||
it("mounts renders properly", () => {
|
||||
const wrapper = mount(App);
|
||||
expect(wrapper.text()).toContain("You did it!");
|
||||
});
|
||||
});
|
||||
9
src/components/AppCounter.vue
Normal file
9
src/components/AppCounter.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useCounterStore } from "@/stores/counter";
|
||||
|
||||
const counter = useCounterStore();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button @click="counter.increment">Count: {{ counter.count }}</button>
|
||||
</template>
|
||||
9
src/main.ts
Normal file
9
src/main.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
import App from "./App.vue";
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(createPinia());
|
||||
|
||||
app.mount("#app");
|
||||
12
src/stores/counter.ts
Normal file
12
src/stores/counter.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ref } from "vue";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useCounterStore = defineStore("counter", () => {
|
||||
const count = ref(0);
|
||||
|
||||
const increment = () => {
|
||||
count.value += 1;
|
||||
};
|
||||
|
||||
return { count, increment };
|
||||
});
|
||||
Reference in New Issue
Block a user