feat(ui): devtools suggestion

This commit is contained in:
Guillaume Chau
2018-06-13 17:58:47 +02:00
parent 9d1bfc5c29
commit 0a2ea1fb02
4 changed files with 80 additions and 10 deletions
+14
View File
@@ -1154,6 +1154,8 @@ api.addSuggestion({
// This will be displayed in a details modal
message: 'A longer message for the modal',
link: 'http://link-to-docs-in-the-modal',
// Optional image
image: '/_plugin/my-package/screenshot.png',
// Function called when suggestion is activated by user
async handler () {
// ...
@@ -1173,6 +1175,18 @@ Then you can remove the suggestion:
api.removeSuggestion('my-suggestion')
```
You can also open a page instead when the user activates the suggestion with `actionLink`:
```js
api.addSuggestion({
id: 'my-suggestion',
type: 'action', // Required
label: 'Add vue-router',
// Open a new tab
actionLink: 'https://vuejs.org/'
})
```
Typically, you will use hooks to display the suggestion in the right context:
```js