Skip to content

Commit

Permalink
fix(ts): Modified import to make it compatible with@ alias
Browse files Browse the repository at this point in the history
In the last commit, I removed aliases like `@component`, `@assets`. They're redundant, and `@` is enough~
  • Loading branch information
ZacharyBear committed Dec 29, 2023
1 parent 1eb6527 commit b75dbae
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions src/assets/style/fonts.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
@font-face {
font-family: Poppins;
src: url('@assets/style/fonts/Poppins/Poppins-Regular.ttf');
src: url('@/assets/style/fonts/Poppins/Poppins-Regular.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: Kanit;
src: url('@assets/style/fonts/Kanit/Kanit-Regular.ttf');
src: url('@/assets/style/fonts/Kanit/Kanit-Regular.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: Kanit;
src: url('@assets/style/fonts/Kanit/Kanit-Bold.ttf');
src: url('@/assets/style/fonts/Kanit/Kanit-Bold.ttf');
font-weight: bold;
font-style: normal;
}
4 changes: 2 additions & 2 deletions src/components/GgColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

<script lang="ts" setup>
import { ref, watch, reactive, onMounted } from 'vue';
import { hsv2rgb, str2rgb, str2rgba, rgb2hsv } from '@assets/js/color.ts';
import GgInput from '@components/GgInput.vue';
import { hsv2rgb, str2rgb, str2rgba, rgb2hsv } from '@/assets/js/color.ts';
import GgInput from '@/components/GgInput.vue';
// vars
const props = defineProps({
Expand Down
10 changes: 5 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import App from './App.vue';
import router from '@/routes/index';
import i18n from '@/assets/lang/index';
// styles
import '@assets/style/common.less';
import '@assets/style/fonts.css';
import '@assets/style/fontawesome/css/fontawesome.css';
import '@assets/style/fontawesome/css/brands.css';
import '@assets/style/fontawesome/css/solid.css';
import '@/assets/style/common.less';
import '@/assets/style/fonts.css';
import '@/assets/style/fontawesome/css/fontawesome.css';
import '@/assets/style/fontawesome/css/brands.css';
import '@/assets/style/fontawesome/css/solid.css';

const app = createApp(App)
.use(router)
Expand Down
8 changes: 4 additions & 4 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
import Welcome from '@views/Welcome.vue';
import Home from '@views/Home.vue';
import About from '@views/About.vue';
import { createRouter, createWebHistory } from 'vue-router';
import Welcome from '@/views/Welcome.vue';
import Home from '@/views/Home.vue';
import About from '@/views/About.vue';

const router = createRouter({
history: createWebHistory(),
Expand Down
4 changes: 2 additions & 2 deletions src/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
</template>

<script lang="ts" setup>
import GlHeader from '@views/global/GlHeader.vue';
import GlFooter from '@views/global/GlFooter.vue';
import GlHeader from '@/views/global/GlHeader.vue';
import GlFooter from '@/views/global/GlFooter.vue';
import { reactive } from 'vue';
type Contributor = {
Expand Down
12 changes: 6 additions & 6 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@

<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue';
import GgSlider from '@components/GgSlider.vue';
import GlHeader from '@views/global/GlHeader.vue';
import GlFooter from '@views/global/GlFooter.vue';
import GgColorPicker from '@components/GgColorPicker.vue';
import GgPop from '@components/GgPop.vue';
import GgSlider from '@/components/GgSlider.vue';
import GlHeader from '@/views/global/GlHeader.vue';
import GlFooter from '@/views/global/GlFooter.vue';
import GgColorPicker from '@/components/GgColorPicker.vue';
import GgPop from '@/components/GgPop.vue';
import GgUpload from '@/components/GgUpload.vue';
import 'prismjs/themes/prism-okaidia.min.css';
import clipboard from 'clipboard';
import i18n from '@assets/lang/index.ts';
import i18n from '@/assets/lang/index.ts';
// vars
const state = reactive({
Expand Down
14 changes: 9 additions & 5 deletions src/views/Welcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@
</template>

<script lang="ts" setup>
import GlHeader from '@views/global/GlHeader.vue';
import GlFooter from '@views/global/GlFooter.vue';
import GlHeader from '@/views/global/GlHeader.vue';
import GlFooter from '@/views/global/GlFooter.vue';
import { onMounted } from 'vue';
import i18n from '@assets/lang/index';
import i18n, { langs } from '@/assets/lang/index';
import gsap from 'gsap';
// get lang from localStorages
onMounted(() => {
const lang = localStorage.getItem('lang');
if (lang) {
i18n.global.locale = lang;
if (lang && lang) {
i18n.global.locale = lang as ('zh' | 'en');
}
gsap.from('#banner .title', {
x: -100
})
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"src/**/*.d.ts",
"src/**/*.vue",
]
}
}

0 comments on commit b75dbae

Please sign in to comment.