ð¯ ãã¹ããã©ã¯ãã£ã¹ - ã¢ãã€ã«éçºãããã«åŒ·åã«ïŒ â
Vant ãã¹ããã©ã¯ãã£ã¹ã¬ã€ããžããããïŒð ããã«ã¯æ°å€ãã®éçºè ã®ç¥æµãéçµããŠããããããžã§ã¯ãæ§ç¯ããæ¬çªç°å¢ãžã®ãããã€ãããã©ãŒãã³ã¹æé©åããã»ãã¥ãªãã£å¯ŸçãŸã§ãäŒæ¥ã¬ãã«ã®ã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããæ¹æ³ãæåãè¶³åããæ¡å ããŸããããã³ããšã³ãåå¿è ã®æ¹ããçµéšè±å¯ãªããã©ã³éçºè ãŸã§ããã®ã¬ã€ããããªãã®éçºã®éãããã¹ã ãŒãºã«ããŸãïŒ
ðïž ãããžã§ã¯ãã¢ãŒããã¯ã㣠- é«å±€ãã«ãåºç€ãã â
ãã£ã¬ã¯ããªæ§é ã®èŠç¯ - æŽçæŽé ãããã³ãŒãã®å®¶ â
æç¢ºãªãã£ã¬ã¯ããªæ§é ã¯ãå®¶ã®åºç€ã®ãããªãã®ã§ãç®ã«ã¯èŠããŸãããããããžã§ã¯ãå šäœã®å®å®æ§ã決å®ããŸããæ°å€ãã®ãããžã§ã¯ãã§æ€èšŒããããã®ãé»éã®æ§é ããèŠãŠã¿ãŸãããïŒ
src/
âââ components/ # ã³ã³ããŒãã³ã - ããªãã®ã³ã³ããŒãã³ãã®å®åº«
â âââ common/ # å
±éã³ã³ããŒãã³ã - ã©ãã§ã䜿ãã䟿å©ãªã¢ã€ãã
â âââ business/ # ããžãã¹ã³ã³ããŒãã³ã - ç¹å®ã®åé¡ã解決ããå°éå®¶
âââ views/ # ãã¥ãŒã³ã³ããŒãã³ã - ãŠãŒã¶ãŒãèŠãçŽ æŽãããäžç
âââ router/ # ã«ãŒã¿ãŒèšå® - ã¢ããªã±ãŒã·ã§ã³ã®äº€éã®èŠ
âââ store/ # ç¶æ
管ç - ããŒã¿ã®äžå€®å庫
âââ utils/ # ãŠãŒãã£ãªãã£é¢æ° - éçºè
ã®ã¹ã€ã¹ã¢ãŒããŒãã€ã
âââ api/ # APIã€ã³ã¿ãŒãã§ãŒã¹ - ããã¯ãšã³ããšã®éä¿¡ã®æ©æž¡ã
âââ assets/ # éçãªãœãŒã¹ - ç»åããã©ã³ããªã©ã®çŸåçŽ æ
âââ styles/ # ã¹ã¿ã€ã«ãã¡ã€ã« - ã¢ããªã±ãŒã·ã§ã³ãçŸããããéæ³äœ¿ãð¡ ãã³ãïŒãã®æ§é ã¯ç¡¬çŽããææ¡ã§ã¯ãªããäœåºŠã詊è¡é¯èª€ãéããçµéšã®é倧æã§ãããããžã§ã¯ãã®èŠæš¡ã«å¿ããŠé©åã«èª¿æŽã§ããŸãããæ žãšãªãèãæ¹ã¯ã責ååé¢ãåã ã圹å²ãæãããããšã§ãïŒ
ã³ã³ããŒãã³ãèšèšã®åå - ãšã¬ã¬ã³ããªã³ãŒããæžãç§èš£ â
åã³ã³ããŒãã³ãã¯åäžã®æ©èœã®ã¿ãæ åœããã³ã³ããŒãã³ãã®ç°¡æœããšä¿å®æ§ãç¶æããã¹ãã§ãã
â è¯ãå®è·µ
// UserProfile.vue - ãŠãŒã¶ãŒæ
å ±è¡šç€ºã®ã¿ãæ
åœ
<template>
<van-card :title="user.name" :desc="user.email" />
</template>â è¯ããªãå®è·µ
// UserDashboard.vue - 責åãå€ããã
<template>
<div>
<!-- ãŠãŒã¶ãŒæ
å ± -->
<!-- 泚æãªã¹ã -->
<!-- ã¡ãã»ãŒãžéç¥ -->
<!-- èšå®ããã« -->
</div>
</template>ð± ã¢ãã€ã«å¯Ÿå¿ - ããããããã€ã¹ã§èŒãã¢ããªã±ãŒã·ã§ã³ â
ã¬ã¹ãã³ã·ããã¶ã€ã³ - 1ã€ã®ã³ãŒããå€çš®å€æ§ãªããã€ã¹ â
ã¢ãã€ã«ããã€ã¹ã¯åå·®äžå¥ã§ãã³ã³ãã¯ããªiPhone SEãã巚倧ãªiPad ProãŸã§ãããªãã®ã¢ããªã±ãŒã·ã§ã³ããã¹ãŠã®ããã€ã¹ã§å®ç§ãªäœéšã«ããã«ã¯ã©ãããã°ããã§ããããïŒçãã¯ããã«ãããŸãïŒ
ããã©ãŒãã³ã¹æé©åæŠç¥ - ããªãã®ã¢ããªã±ãŒã·ã§ã³ãé«éåïŒ â
ãŠãŒã¶ãŒã®å¿èã«ã¯éçããããŸãã3ç§ä»¥å ã«èªã¿èŸŒãŸããªãå Žåã圌ãã¯èºèºãªãé¢ããŠããŸããŸãããããã®ãé«éåã®ç§èš£ãã§ããªãã®ã¢ããªã±ãŒã·ã§ã³ã皲劻ã®ããã«éãããŸãããïŒ
ðš ã¹ã¿ã€ã«ç®¡ç - ããªãã®ã¢ããªã±ãŒã·ã§ã³ãçŸãã â
CSS倿°ã®ã«ã¹ã¿ãã€ãº - ã¯ã³ã¯ãªãã¯ã§ããŒã倿Žã®éæ³ â
:root {
/* ããŒãã«ã©ãŒ */
--van-primary-color: #1989fa;
--van-success-color: #07c160;
--van-danger-color: #ee0a24;
/* ããã¹ãã«ã©ãŒ */
--van-text-color: #323233;
--van-text-color-2: #646566;
--van-text-color-3: #969799;
/* èæ¯ã«ã©ãŒ */
--van-background-color: #f7f8fa;
--van-background-color-light: #fafafa;
}ã¹ã¿ã€ã«ã®çµç¹å - CSSã®æ··ä¹±ã«å¥ããåãã究極ã®è§£æ±ºç â
ç¹å®ã®ã¹ã¿ã€ã«ãèŠã€ãããã«ã€ã©ã€ã©ããŠããŸãããïŒã¹ã¿ã€ã«ã®è¡çªã«æ©ãã§ããŸãããïŒè¯ãã¹ã¿ã€ã«çµç¹åã®æ¹æ³ã¯ãããªãã®éçºå¹çãåå¢ãããŸãïŒ
ð ãã¡ã€ã«æ§é
- variables.scss - 倿°å®çŸ©
- mixins.scss - ããã¯ã¹ã€ã³é¢æ°
- base.scss - åºæ¬ã¹ã¿ã€ã«
- components.scss - ã³ã³ããŒãã³ãã¹ã¿ã€ã«
ð¯ åœåèŠå
- BEMåœåæ³
- æå³ã®ããã¯ã©ã¹å
- ã¹ã¿ã€ã«ã®è¡çªãé¿ãã
- äžè²«æ§ãä¿ã€
ð§ éçºããŒã« - ä»äºãæãéããã«ã¯ããŸãéå ·ãæŽãã â
æšå¥šããŒã«ãã§ãŒã³ - éçºè ã®å€¢ã®ããŒã â
ãããã®ããŒã«ã¯ã¹ãŒããŒããŒããŒé£çã®ãããªãã®ã§ãããããç¬èªã®è¶ èœåãæã¡ãçµã¿åãããããšã§å¥è·¡ãçã¿åºããŸãïŒ
ð ãããã€æé©å - ããªãã®ã¢ããªã±ãŒã·ã§ã³ãæ¬çªç°å¢ãž â
ãã«ãæé©å - ãã³ããªã³ã°ã®èžè¡ â
åªãããã«ãèšå®ã¯ãããªãã®ã¢ããªã±ãŒã·ã§ã³ã®ãµã€ãºãå°ããããèªã¿èŸŒã¿ãéããããŠãŒã¶ãŒäœéšãåäžãããŸããããã¯åãªãæè¡ã§ã¯ãªããèžè¡ã§ãïŒ
// vite.config.js
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'vue-router'],
vant: ['vant']
}
}
}
}
})CDNé«éå - äžçäžã®ãŠãŒã¶ãŒãããªãã®ã¢ããªã±ãŒã·ã§ã³ãç¬æã«éããããã« â
CDNã¯äžçäžã«ããªãã®ãå身ãããããããªãã®ã§ããŠãŒã¶ãŒãã¢ã¯ã»ã¹ãããšãã¯åžžã«æãè¿ããã®ãèŠã€ããããã®ã§ãé床ã¯åœç¶éããªããŸãïŒ
𧪠ãã¹ãæŠç¥ - å質ä¿èšŒã®è·åæ²³ â
ãã¹ããã©ããã - å£ããªãå質é²ç·ãæ§ç¯ â
ãã¹ãã¯è² æ ã§ã¯ãªããã³ãŒãå質ã®å®è·ç¥ã§ãïŒå®å šãªãã¹ãäœç³»ãããã°ããªãã¡ã¯ã¿ãªã³ã°æãèªä¿¡ãæã¡ããªãªãŒã¹æãå®å¿ããããšãã§ããŸãã
åäœãã¹ã (70%)
åã ã®ã³ã³ããŒãã³ããšé¢æ°ã®æ©èœããã¹ã
çµ±åãã¹ã (20%)
ã³ã³ããŒãã³ãéã®çžäºäœçšãšAPIåŒã³åºãããã¹ã
ãšã³ãããŒãšã³ããã¹ã (10%)
å®å šãªãŠãŒã¶ãŒãããŒããã¹ã
ð ã¢ãã¿ãªã³ã°ãšåæ - ãŠãŒã¶ãŒè¡åãæŽå¯ããæ°Žæ¶ç â
ããã©ãŒãã³ã¹ã¢ãã¿ãªã³ã° - ããŒã¿ã«èªããã â
ã¢ãã¿ãªã³ã°ã®ãªãã¢ããªã±ãŒã·ã§ã³ã¯ãç®é ãã§é転ãããããªãã®ã§ããŠãŒã¶ãŒãã©ãã§åé¡ã«ééããŠãããæ°žé ã«ããããŸãããããŒã¿ã®åã§åé²ã®éãç §ãããŸãããïŒ
ð ã»ãã¥ãªãã£ãã¹ããã©ã¯ãã£ã¹ - ããªãã®ã¢ããªã±ãŒã·ã§ã³ã«é²åŒŸãã§ããã â
ããã³ããšã³ãã»ãã¥ãªã㣠- ãŠãŒã¶ãŒããŒã¿ãå®ãéŒéã®é·å â
ã»ãã¥ãªãã£ã¯ãªãã·ã§ã³ã®è£ 食åã§ã¯ãªããã¢ããªã±ãŒã·ã§ã³ã®çåœç·ã§ãã1ã€ã®ã»ãã¥ãªãã£è匱æ§ãããªãã®ãã¹ãŠã®åªåãå°ç¡ãã«ããå¯èœæ§ããããŸããäžç·ã«å åºãªé²è¡ç·ãç¯ããŸãããïŒ
ð¡ïž XSS察ç
- å ¥åæ€èšŒãšãã£ã«ã¿ãªã³ã°
- åºåãšã³ã³ãŒãã£ã³ã°
- CSPããªã·ãŒ
ð ããŒã¿ã»ãã¥ãªãã£
- HTTPSéä¿¡
- æ©å¯æ å ±ã®æå·å
- Tokenã®å®å šãªä¿å
ð åŠç¿ãªãœãŒã¹ - ç¶ç¶çãªé²æ©ã®ããã®çµŠæ²¹æ â
æè¡ã¯æ¥ã é²åããŠãããçµ¶ããåŠç¿ãç¶ããããšã§æä»£ã®æ©ã¿ã«è¿œãã€ããŸãããããã®ãªãœãŒã¹ã¯ããªãã®æé·ã®éãç §ããç¯å°ãšãªãã§ãããïŒ
ð ãŸãšã â
ããã§ãšãããããŸãïŒð ãã®ãã¹ããã©ã¯ãã£ã¹ã¬ã€ããéããŠãé«å質ãªã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããã®æ žãšãªãã¹ãã«ãç¿åŸããŸããããããžã§ã¯ãã¢ãŒããã¯ãã£ãããããã€æé©åãããã©ãŒãã³ã¹ã¢ãã¿ãªã³ã°ããã»ãã¥ãªãã£å¯ŸçãŸã§ããããã®çµéšã¯ããªãã®éçºã®éã«ããã貎éãªè²¡ç£ãšãªãã§ãããã
èŠããŠãããŠãã ããããã¹ããã©ã¯ãã£ã¹ã¯äžå€ã®ææ¡ã§ã¯ãªããå®è·µã®äžã§çµ¶ããé²åããç¥æµã®çµæ¶ã§ããåŠç¿ã®å§¿å¢ãä¿ã¡ããããžã§ã¯ãã§æè»ã«æŽ»çšããã°ãå¿ ãããåªããã³ãŒããæžããããã«ãªããŸãïŒðª
ð é¢é£ã³ã³ãã³ã â
ãã£ãšç¥ãããã§ããïŒãããã®ããã¥ã¡ã³ããæ°ããªäžçãžã®æãéããŸãïŒ
- ð ã¯ã€ãã¯ã¹ã¿ãŒã - ãŒãããå§ããVantã®æ
- ð Vue3 ã€ã³ãã°ã¬ãŒã·ã§ã³ - æªæ¥ãåãå ¥ããVue3ãšå®ç§ã«èå
- ð TypeScript ã¬ã€ã - åå®å šã§éçºãå®å¿
- ðš ããŒãã«ã¹ã¿ãã€ãº - ç¬èªã®ããžã¥ã¢ã«äœéšãåµãåºã
- â¡ ããã©ãŒãã³ã¹æé©å - ããªãã®ã¢ããªã±ãŒã·ã§ã³ã皲劻ã®ããã«é«éå
- ð± ã¢ãã€ã«å¯Ÿå¿ - ããããããã€ã¹ã«å®ç§ã«é©å
- ð¯ ãã¶ã€ã³èŠç¯ - ãã¶ã€ã³ååã«åŸããåªããäœéšãåµãåºã
- ð Vant 4 - ææ°ããŒãžã§ã³ãæ©èœãããã«åŒ·å
- ðŠ Vant Weapp - ããã¢ããªéçºã®é Œããã婿
- â ãããã質å - éçºäžã®é£åã解決
- ð ãåãåãã - åé¡ãçºçããŸãããïŒãã€ã§ããµããŒãããããŸã