mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-11 11:20:18 -05:00
docs: fix prompts API codes (#1557)
This commit is contained in:
committed by
Guillaume Chau
parent
6e690f355a
commit
21ccd2fe1d
@@ -246,13 +246,13 @@ A prompt module should export a function that receives a [PromptModuleAPI][promp
|
||||
``` js
|
||||
module.exports = api => {
|
||||
// a feature object should be a valid inquirer choice object
|
||||
cli.injectFeature({
|
||||
api.injectFeature({
|
||||
name: 'Some great feature',
|
||||
value: 'my-feature'
|
||||
})
|
||||
|
||||
// injectPrompt expects a valid inquirer prompt object
|
||||
cli.injectPrompt({
|
||||
api.injectPrompt({
|
||||
name: 'someFlag',
|
||||
// make sure your prompt only shows up if user has picked your feature
|
||||
when: answers => answers.features.include('my-feature'),
|
||||
@@ -262,7 +262,7 @@ module.exports = api => {
|
||||
|
||||
// when all prompts are done, inject your plugin into the options that
|
||||
// will be passed on to Generators
|
||||
cli.onPromptComplete((answers, options) => {
|
||||
api.onPromptComplete((answers, options) => {
|
||||
if (answers.features.includes('my-feature')) {
|
||||
options.plugins['vue-cli-plugin-my-feature'] = {
|
||||
someFlag: answers.someFlag
|
||||
|
||||
Reference in New Issue
Block a user