Explain how to use Vue based Widgets
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, laravel, php, vite
- Lĩnh vực
- documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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...
- Ngôn ngữ chính
- PHP
- Star
- 133
- Fork
- 405
- Merge trung bình
- 21 giờ 45 phút
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của statamic/docs
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Chunked UploadsĐang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Installation / Deployment Guides
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 40/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Document how conditions treat empty and null valuesCó thể đã có người làm @joshdaugherty đã nhận 12 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của statamic/docs
Issue tương tự
-
cloning objets from planningĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
glpi-project/glpi#25922 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Translation TwigBridge
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23308 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Перевод устарел
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100