You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel+Vite+Vue项目中PrimeVue组件显示但无法交互求助

PrimeVue多数组件在Laravel+Vite+Vue项目中无法交互(仅Dropdown正常)

我在Laravel、Vite和Vue.js组成的项目中使用PrimeVue,发现多数组件仅能显示却无法正常交互,只有Dropdown组件可以正常工作。具体异常表现:

  • FloatLabel的标签不会在点击输入框后移至输入框上方;
  • InputSwitch点击后无切换反应;
  • Knob、Rating组件也无法响应交互操作。

原以为是Tailwind导致的问题,尝试使用无样式版本并适配Tailwind,但仍未解决。


项目相关代码

app.js(等同于main.js)

import "./bootstrap";
import router from "./router";
import { createApp } from "vue";
import PrimeVue from 'primevue/config';
import 'primevue/resources/themes/mdc-light-indigo/theme.css'

import App from "./App.vue";

const app = createApp(App)

export function checkISMobile(){
    if(screen.width <= 760){
        return true;
    }
    return false
}

app.use(router)
app.use(PrimeVue, {
    ripple: true,
    inputStyle: "filled"
})

app.mount('#app')

app.css

@layer tailwind-base, primevue, tailwind-utilities;

@layer tailwind-utilities {
    @tailwind components;
    @tailwind utilities;
}

组件使用代码

<template>
    <h1>Search Page</h1>
    <Dropdown v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" class="w-full md:w-14rem" />
<br><br>
<h4>FloatLabel</h4>
    <FloatLabel>
    <InputText id="username" v-model="username" />
    <label for="username">Username</label>
</FloatLabel>

    <Knob v-model="value" />
    <InputSwitch v-model="checked" />

    <Rating v-model="value" />

</template>

内容的提问来源于stack exchange,提问作者Zahir Bobat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 15:00:28