feat: Add Vue3 exercises and interview plan
- Introduced Vue3 exercises covering composable API, reactivity, lifecycle hooks, and built-in components. - Added structured interview plan for frontend candidates focusing on HTML, CSS, JavaScript, TypeScript, and Vue. - Included starter files for each exercise and detailed README documentation for guidance.
This commit is contained in:
27
08-vue3/06-slots-and-provide-inject/starter.js
Normal file
27
08-vue3/06-slots-and-provide-inject/starter.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { createApp, provide, inject } = Vue;
|
||||
|
||||
createApp({
|
||||
components: {
|
||||
ThemeCard: {
|
||||
setup() {
|
||||
const themeColor = inject("themeColor");
|
||||
|
||||
return {
|
||||
themeColor,
|
||||
};
|
||||
},
|
||||
template: `
|
||||
<article class="card">
|
||||
<h2>主题卡片</h2>
|
||||
<button type="button" :style="{ background: themeColor }">
|
||||
<slot>默认按钮</slot>
|
||||
</button>
|
||||
</article>
|
||||
`,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
// 任务:通过 provide 提供 themeColor
|
||||
return {};
|
||||
},
|
||||
}).mount("#app");
|
||||
Reference in New Issue
Block a user