Vue3笔记

笔记自用 仅供参考

npm 换源

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// 查询源
npm config get registry

// 更换国内源
npm config set registry https://registry.npmmirror.com

// 恢复官方源
npm config set registry https://registry.npmjs.org

// 删除注册表
npm config delete registry

Tailwind CSS

快速安装

1
2
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

编辑 tailwind.config.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/** @type {import('tailwindcss').Config} */
export default {
  content: [
    "./index.html",
    "./src/**/*.{vue,js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

引入

1
2
3
@tailwind base; 
@tailwind components;
@tailwind utilities;  /*只用到基础的 引用这个就可以了*/

执行以上步骤后但是tailwind没有生效可以在vite.config.js中增加配置

1
2
3
4
5
css: {
  postcss: {
    plugins: [require("tailwindcss"), require("autoprefixer")]
  }
}
0%