提交 242e975a 编写于 作者: Z zhaoshuangshi

整体格式初始化、添加高阶习题内容

上级 7d41326e
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"author": "JHXL_", "author": "JHXL_",
"source": "exercises.md", "source": "exercises.md",
"notebook_enable": false, "notebook_enable": false,
"exercise_id": "1d5731d11b5a40bfa4325b16a1bcc63a" "exercise_id": "9343839125bb4c9fb7f6d6ea4acbabbc"
} }
\ No newline at end of file
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
"SSR" "SSR"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"SSR" "SSR"
], ],
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"Nuxt.js" "Nuxt.js"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"Nuxt.js" "Nuxt.js"
], ],
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"render" "render"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"render" "render"
], ],
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"createElement" "createElement"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"createElement" "createElement"
], ],
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"author": "zhaoshuangshi", "author": "zhaoshuangshi",
"source": "exercises.md", "source": "exercises.md",
"notebook_enable": false, "notebook_enable": false,
"exercise_id": "c39802e0a80948a5b6225ac98fa33dcd" "exercise_id": "4d356682390f480bbd0a6fb578b84c83"
} }
\ No newline at end of file
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"JSX" "JSX"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"JSX" "JSX"
], ],
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"author": "zhaoshuangshi", "author": "zhaoshuangshi",
"source": "exercises.md", "source": "exercises.md",
"notebook_enable": false, "notebook_enable": false,
"exercise_id": "c39802e0a80948a5b6225ac98fa33dcd" "exercise_id": "a44cff1364c544e58c5577adcc47c58e"
} }
\ No newline at end of file
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"函数组件化" "函数组件化"
], ],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [ "keywords_must": [
"函数组件化" "函数组件化"
], ],
......
# 函数式组件 # 函数式组件
在Vue中,函数式组件的特点是什么? 在Vue中,函数式组件的特点是什么?
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "vue-2264eaa86af346ada222d824dbf4f251", "node_id": "vue-2264eaa86af346ada222d824dbf4f251",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "exercises.md",
"notebook_enable": false,
"exercise_id": "87c72263370b489c97d77ceac47a4ac6"
}
\ No newline at end of file
# 混入的使用
在Vue中使用混入的作用是什么?
## 答案
用于向组件注入特定的方法或属性。
## 选项
### A
用于在组件中引入其他组件。
### B
用于在组件中定义数据模型。
### C
用于在组件中渲染特定的HTML元素。
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "vue-5f2921b71ba146f28ad7ae318340f757", "node_id": "vue-5f2921b71ba146f28ad7ae318340f757",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "exercises.md",
"notebook_enable": false,
"exercise_id": "3a7a26d26337428d92011e05184efe8f"
}
\ No newline at end of file
# 选项合并
当一个组件和混入对象都定义了同名的选项时,它们会如何合并?
## 答案
组件选项会覆盖混入对象的选项。
## 选项
### A
混入对象的选项会覆盖组件选项。
### B
Vue会自动解决冲突,并将它们合并成一个选项。
### C
会抛出一个错误,要求我们手动解决冲突。
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "vue-12334bd7fc854840bc99e3a7cf1ceaa3", "node_id": "vue-12334bd7fc854840bc99e3a7cf1ceaa3",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "exercises.md",
"notebook_enable": false,
"exercise_id": "43a64878427c46dd8af276a65a494600"
}
\ No newline at end of file
# 函数式组件
```javaScript
// 创建一个全局混入对象
Vue.mixin({
created: function () {
console.log('全局混入对象已创建')
}
})
// 创建一个组件
var myComponent = Vue.extend({
created: function () {
console.log('组件已创建')
}
})
// 使用组件
new myComponent()
```
上面的代码展示了如何在Vue中创建一个全局混入对象。这段代码会输出什么?
## 答案
会先输出“全局混入对象已创建”,然后输出“组件已创建”。
## 选项
### A
只会输出“组件已创建”。
### B
只会输出“全局混入对象已创建”。
### C
会先输出“组件已创建”,然后输出“全局混入对象已创建”。
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "vue-f6cd70121d7d43a9b87966012f4163a2", "node_id": "vue-f6cd70121d7d43a9b87966012f4163a2",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"exercises.json"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "exercises.md",
"notebook_enable": false,
"exercise_id": "0859b22e34bc43b9a51bf03e3aa7cc30"
}
\ No newline at end of file
# 自定义选项策略
为一个Vue应用程序编写一个混入对象,该混入对象需要有一个名为title的选项。你想要自定义选项策略以确保title选项始终具有正确的值。以下哪种选项策略是正确的?
## 答案
使用Vue.config.optionMergeStrategies来覆盖title选项的默认合并策略,然后在自定义合并函数中始终返回混入对象的title值。
## 选项
### A
在混入对象中定义一个名为title的函数,并在该函数中返回混入对象的title值。然后,在创建Vue实例时,将该函数作为title选项的值传递给Vue构造函数。
### B
在混入对象中定义一个名为title的监听器函数,并在该函数中返回混入对象的title值。然后,在使用混入对象的组件中,使用 watch 选项将该函数添加到组件的选项中。
### C
在混入对象中定义一个名为title的计算属性,并在该计算属性中返回混入对象的title值。然后,在使用混入对象的组件中,将该计算属性添加到组件的computed选项中。
{
"node_id": "vue-ccfffc43755249efbee6ca3706d49aef",
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册