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

Quasar2/Vue3(Vite搭建)能否用Pug模板?需换回Webpack吗?

在Quasar2/Vue3(Vite构建)项目中使用Pug模板的解决方案

不需要换回Webpack,只需安装必要依赖即可解决报错:

1. 安装Pug依赖

在项目根目录执行以下命令之一(根据你使用的包管理器选择):

# npm
npm install pug --save-dev

# yarn
yarn add pug -D

# pnpm
pnpm add pug -D

2. 修复Pug模板代码(可选,保持样式一致)

你修改后的Pug代码缺少原模板中的flex-center类,建议修正为:

<template lang="pug">
q-page.flex.flex-center
  b3 Hello from Counters!
</template>

3. 重启开发服务器

依赖安装完成后,重启Quasar开发服务,Pug模板即可正常编译,报错会消失。


内容的提问来源于stack exchange,提问作者Jacques Robin

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.25 06:16:20