1.vueä¸çprovideåinject
vueä¸çprovideåinject
é 读element-uiæºç ï¼åç°å¨è®¾è®¡åç»æ¶ä»¶ç¨å°äº inject å±æ§ï¼éå³æ¥äºä¸ä¸ å®æ¹ææ¡£ï¼å¾ç¥vueå¨2.2.0çæ¬éæ°å¢äº provide / inject ï¼æç §ææ¡£çæè¿°ï¼æçç解æ¯ï¼å¨å¤çº§åµå¥çç»ä»¶ä½ç³»ä¸ï¼æ级å¤å±ç»ä»¶å¯ä»¥éè¿ provide å±æ§åå ¶ä¸ä»»æä¸çº§åç»ä»¶æä¾ä¸ä¸ªä¾èµï¼ä¸ç®¡å±çº§æå¤æ·±ï¼èæ级åç»ä»¶åå¯ä»¥éè¿ inject å±æ§æ¥æ¶æ¥èªå ¶ä¸ä»»æä¸çº§ç¶ç»ä»¶æä¾çä¾èµï¼éè¿ this.xxx å½¢å¼è·åï¼ã注æï¼ provide å inject éè¦ä¸èµ·ä½¿ç¨ã
举个ä¾å说æï¼
æ¸ æä¸ä½çå¸ï¼åº·çï¼çç¨ï¼ãéæ£ï¼è¤ç¦ï¼ãä¹¾éï¼å¼åï¼æ¯ç¥åä¸ä»£ï¼æ们ç¨vueç»ä»¶çææ³è¡¨ç¤ºä»ä»¬ä¹é´çå ³ç³»ï¼å¹¶æ¨¡æä»ä»¬çä¸æ®µå¯¹è¯ï¼ä»¥æ¤ç解vueä¸ç provide å inject ã
è°ç¨ç»ä»¶ââå¤§æ¸ å¸å½ï¼qing-dynasty.vue
å®ä¹ç·ç·ç»ä»¶ââ康ççå¸ï¼kangxi.vue
å®ä¹å¿åç»ä»¶ââéæ£çå¸ï¼yongzheng.vue
å®ä¹ååç»ä»¶ââä¹¾éï¼qianlong.vue
2024-12-22 17:05
2024-12-22 16:52
2024-12-22 16:40
2024-12-22 16:28
2024-12-22 15:56
2024-12-22 15:25