範例如下,透過以下方式,將資料傳入vue
public function edit(Request $request): Response
{
return Inertia::render('Profile/Edit', [
'mustVerifyEmail' => $request->user() instanceof MustVerifyEmail,
'status' => session('status'),
]);
}
在vue中透過props接收資料,此檔案位置為resources\js\PagesProfile\Edit
<script>
export default {
props: {
mustVerifyEmail: String,
status: String,
}
}
</script>
可在 middleware
裡的 HandleInertiaRequests.php
設定全域變數
public function share(Request $request): array
{
return array_merge(parent::share($request), [
'auth' => [
'user' => $request->user(),
],
'ziggy' => function () use ($request) {
return array_merge((new Ziggy)->toArray(), [
'location' => $request->url(),
]);
},
]);
}
在vue中透過以下方法使用
<div class="font-medium text-base text-gray-800">
{{ $page.props.auth.user.name }}
</div>
npm install element-plus --save
只需增加有 Add this line 註解的行數
import "./bootstrap";
import "../css/app.css";
import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/vue3";
import ElementPlus from "element-plus"; // Add this line
import "element-plus/dist/index.css"; // Add this line
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { ZiggyVue } from "../../vendor/tightenco/ziggy/dist/vue.m";
const appName =
window.document.getElementsByTagName("title")[0]?.innerText || "Laravel";
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.vue`,
import.meta.glob("./Pages/**/*.vue")
),
setup({ el, App, props, plugin }) {
return createApp({ render: () => h(App, props) })
.use(plugin)
.use(ZiggyVue, Ziggy)
.use(ElementPlus) // Add this line
.mount(el);
},
progress: {
color: "#4B5563",
},
});
更改 Dashboard.vue
<script setup>
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
import { Head } from '@inertiajs/vue3';
import { ref } from 'vue'
const value1 = ref([])
const value2 = ref([])
const value3 = ref([])
const value4 = ref([])
const options = [
{
value: 'Option1',
label: 'Option1',
},
{
value: 'Option2',
label: 'Option2',
},
{
value: 'Option3',
label: 'Option3',
},
{
value: 'Option4',
label: 'Option4',
},
{
value: 'Option5',
label: 'Option5',
},
]
</script>
<template>
<Head title="Dashboard" />
<AuthenticatedLayout>
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Dashboard</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">You're logged in!</div>
</div>
</div>
</div>
<div class="m-4">
<p>default</p>
<el-select v-model="value1" multiple placeholder="Select" style="width: 240px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div class="m-4">
<p>use collapse-tags</p>
<el-select v-model="value2" multiple collapse-tags placeholder="Select" style="width: 240px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div class="m-4">
<p>use collapse-tags-tooltip</p>
<el-select v-model="value3" multiple collapse-tags collapse-tags-tooltip placeholder="Select"
style="width: 240px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div class="m-4">
<p>use max-collapse-tags</p>
<el-select v-model="value4" multiple collapse-tags collapse-tags-tooltip :max-collapse-tags="3"
placeholder="Select" style="width: 240px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</AuthenticatedLayout>
</template>
成果如下圖
首先先到LINE Developers建立一個message api
Sep 27, 2024紀錄一下使用踩到的坑以及銜接步驟
Sep 20, 2024Laravel A網站到B網站無須再次登入
Jun 20, 2024目前已有不少基於面向服務架構和基於微服務架構的物聯網中間件的研究成果。面向服務架構是一種將軟件系統分解為一系列可復用的服務的方法,通常使用企業服務總線作為服務間的通信機制。基於面向服務架構的物聯網中間件可以實現設備的服務化,但也存在一些缺點,例如架構的複雜性、開發和維護的成本、服務的耦合性、設備的持續集成和動態擴展的困難等。微服務架構是一種將軟件系統分解為一系列高內聚低耦合的微服務的方法,通常使用輕量級的通信協議作為服務間的通信機制。基於微服務架構的物聯網中間件可以充分利用微服務的優勢,例如架構的靈活性、開發和部署的速度、服務的獨立性、設備的多樣性和動態性的支持等。我們對比了一些現有的物聯網中間件的研究成果,發現它們都沒有充分考慮物聯網設備在通信協議、傳輸網絡、數據處理分級等方面的異構性,也沒有詳細地考慮多用戶場景下的服務衝突問題以及第三方物聯網系統的互操作支持。
Jun 18, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up