Explain how to use Vue based Widgets
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 55/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, laravel, php, vite
- Ambito
- documentation
Direzione di ricerca
Start with the Widgets documentation and compare it with the linked Vite Tooling page. Explain the package.json dependency, the Vite plugin setup, and registering the Vue component in cp.js, including the working component name shown in the issue. Done when the Widget guide lets a reader follow the steps and see the component render; the issue names no documentation file or test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The documentation explains how to create a Widget, but doesn't actually explain how to get it to render...
If I just follow the steps in the docs, the Dashboard will try render the component but you'll see this in the source:
<div class="px-3 starting-style-transition null w-full">
<missingtranslations message="Hello World!"></missingtranslations>
</div>
This is for a component called MissingTranslations
<?php
namespace App\Widgets;
use Statamic\Facades\Entry;
use Statamic\Sites\Sites;
use Statamic\Widgets\VueComponent;
use Statamic\Widgets\Widget;
class MissingTranslations extends Widget
{
public function component()
{
return VueComponent::render('MissingTranslations', [
'message' => 'Hello World!',
]);
}
}
To actually get the Widget to render you need to follow some steps in the Vite Tooling page:
First the package.json needs to be updated to install @statamic
"dependencies": {
"@statamic/cms": "file:./vendor/statamic/cms/resources/dist-package"
},
Then you need to run npm install and add the Statamic plugin to the Vite config:
import statamic from '@statamic/cms/vite-plugin';
export default defineConfig({
plugins: [
laravel({ ... }),
statamic(),
],
});
And then the component still needs to be registered? in cp.js
import MissingTranslations from './components/widgets/MissingTranslations.vue';
Statamic.booting(() => {
// Statamic.$components.register('missing-translations', MissingTranslations); // doesnt work
// Statamic.$components.register('missingtranslations', MissingTranslations); // doesnt work
Statamic.$components.register('MissingTranslations', MissingTranslations); // works
});
That's a lot of extra steps that seem to be missing and important? I can't figure out if there was an easier way to get it to do all this automatically or if I totally missed something...
- Lingua principale
- PHP
- Stelle
- 133
- Fork
- 405
- Merge medio
- 21h 45m
- PR unite (30g)
- 12
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di statamic/docs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Chunked UploadsAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Installation / Deployment Guides
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 40/100
I maintainer di solito rispondono entro 1 giorno
-
Document how conditions treat empty and null valuesForse già presa @joshdaugherty l’ha presa 15 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di statamic/docs
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
TYPO3BestPractices/tea#2409 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
api-platform/core#8690 ·
I maintainer di solito rispondono entro 1 giorno
-
No Code Attached Yet
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
joomla/joomla-cms#48626 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DorsetDigital/silverstripe-schema-manager#26 ·
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 4 giorni