// 安装pug和加载器 yarn add pug-loader pug-plain-loader pug --dev
// webpack.config.js中 添加规则 { test: /.pug$/, use: ['pug-plain-loader'] }
使用
<template lang="pug"> div </template> <script> export default {} </script> <style> </style>
如果不装pug-plain-loader会报错:
Component template requires a root element, rather than just text.
参考:https://stackoverflow.com/questions/51073702/vue-pug-language-has-not-been-recognized-in-vue-template