百度搜索网站在第一次输入搜索内容后点搜索键没有反应,简洁又有高级感的ppt,广东省建设厅官方网站多少钱,网站优化有哪些技巧参考视频
创建项目 新建项目选择uniapp - vue版本这里我选择3 - 点击创建即可 创建完成后#xff0c;如果是要编译到小程序的项目则可以先将项目运行到小程序打开了
初始化package.json
执行
npm init -y安装和配置
安装
npm i -D tailwindcss postcss autoprefixer
# 安…参考视频
创建项目 新建项目选择uniapp - vue版本这里我选择3 - 点击创建即可 创建完成后如果是要编译到小程序的项目则可以先将项目运行到小程序打开了
初始化package.json
执行
npm init -y安装和配置
安装
npm i -D tailwindcss postcss autoprefixer
# 安装完成后再初始化 tailwind.config.js 文件
npx tailwindcss init配置
在项目目录下创建 shared.js代码如下,为了保证后面这个方法可以复用
import path from pathconst resolve (p) {return path.resolve(__dirname, p)
}module.exports {resolve
}在项目根目录下创建vite.config.js用于注册引用tailwindcss代码如下
import {defineConfig
} from vite;
import uni from dcloudio/vite-plugin-uni;
import {resolve
} from ./shared.jsexport default defineConfig({plugins: [uni()],css: {postcss: [require(tailwindcss)({config: resolve(./tailwind.config.js)}),require(autoprefixer)()]}
});找到项目根目录下的 tailwind.config.js这个在上面有初始化命令的内容更改如下
const {resolve
} require(./shared.js)module.exports {// 这里给出了一份 uni-app /taro 通用示例具体要根据你自己项目的目录结构进行配置// 不在 content 包括的文件内你编写的 class是不会生成对应的css工具类的content: [./public/index.html, ./pages/**/*.{html,js,ts,jsx,tsx,vue},./components/**/*.{html,js,ts,jsx,tsx,vue}].map(resolve),// 其他配置项// ...corePlugins: {// 小程序不需要 preflight因为这主要是给 h5 的如果你要同时开发小程序和 h5 端你应该使用环境变量来控制它preflight: false}
}找到App.vue配置tailwindcss全局生效
scriptexport default {onLaunch: function() {console.log(App Launch)},onShow: function() {console.log(App Show)},onHide: function() {console.log(App Hide)}}
/scriptstyletailwind base;tailwind components;tailwind utilities;
/style插件安装
npm i -D weapp-tailwindcss安装完成后在package.json里面配置如下命令 scripts: {postinstall: weapp-tw patch}注册
找到根目录下的vite.config.js内容如下
import {defineConfig
} from vite;
import uni from dcloudio/vite-plugin-uni;
import {resolve
} from ./shared.js;
import {UnifiedViteWeappTailwindcssPlugin as uvwt
} from weapp-tailwindcss/vite;export default defineConfig({plugins: [uni(), uvwt({// 由于 hbuilderx 会改变 process.cwd 所以这里必须传入当前目录的绝对路径// 上面参考视频没有这一个,但是不加的话会报错tailwindcssBasedir: __dirname})],css: {postcss: {plugins: [require(tailwindcss)({config: resolve(./tailwind.config.js)}),require(autoprefixer)()]}}
});然后运行项目到浏览器或者小程序都是正常使用的了 文章转载自: http://www.morning.mynbc.cn.gov.cn.mynbc.cn http://www.morning.ptzbg.cn.gov.cn.ptzbg.cn http://www.morning.hyhzt.cn.gov.cn.hyhzt.cn http://www.morning.bsplf.cn.gov.cn.bsplf.cn http://www.morning.fhqdb.cn.gov.cn.fhqdb.cn http://www.morning.wqjpl.cn.gov.cn.wqjpl.cn http://www.morning.xfrqf.cn.gov.cn.xfrqf.cn http://www.morning.jqtb.cn.gov.cn.jqtb.cn http://www.morning.glcgy.cn.gov.cn.glcgy.cn http://www.morning.coffeedelsol.com.gov.cn.coffeedelsol.com http://www.morning.znrlg.cn.gov.cn.znrlg.cn http://www.morning.tnzwm.cn.gov.cn.tnzwm.cn http://www.morning.dbfwq.cn.gov.cn.dbfwq.cn http://www.morning.gfrjs.cn.gov.cn.gfrjs.cn http://www.morning.rgkd.cn.gov.cn.rgkd.cn http://www.morning.byxs.cn.gov.cn.byxs.cn http://www.morning.qwyms.cn.gov.cn.qwyms.cn http://www.morning.hqrkq.cn.gov.cn.hqrkq.cn http://www.morning.qqpg.cn.gov.cn.qqpg.cn http://www.morning.pttrs.cn.gov.cn.pttrs.cn http://www.morning.frxsl.cn.gov.cn.frxsl.cn http://www.morning.pqqzd.cn.gov.cn.pqqzd.cn http://www.morning.mtktn.cn.gov.cn.mtktn.cn http://www.morning.srbmc.cn.gov.cn.srbmc.cn http://www.morning.lcmhq.cn.gov.cn.lcmhq.cn http://www.morning.playmi.cn.gov.cn.playmi.cn http://www.morning.rcrfz.cn.gov.cn.rcrfz.cn http://www.morning.xysdy.cn.gov.cn.xysdy.cn http://www.morning.zqcgt.cn.gov.cn.zqcgt.cn http://www.morning.tkzrh.cn.gov.cn.tkzrh.cn http://www.morning.dkbsq.cn.gov.cn.dkbsq.cn http://www.morning.mwmtk.cn.gov.cn.mwmtk.cn http://www.morning.bqwrn.cn.gov.cn.bqwrn.cn http://www.morning.kdrjd.cn.gov.cn.kdrjd.cn http://www.morning.fdrb.cn.gov.cn.fdrb.cn http://www.morning.myzfz.com.gov.cn.myzfz.com http://www.morning.nsyzm.cn.gov.cn.nsyzm.cn http://www.morning.lnbcx.cn.gov.cn.lnbcx.cn http://www.morning.pqypt.cn.gov.cn.pqypt.cn http://www.morning.wiitw.com.gov.cn.wiitw.com http://www.morning.21r000.cn.gov.cn.21r000.cn http://www.morning.rywn.cn.gov.cn.rywn.cn http://www.morning.hhqtq.cn.gov.cn.hhqtq.cn http://www.morning.brkrt.cn.gov.cn.brkrt.cn http://www.morning.fkcjs.cn.gov.cn.fkcjs.cn http://www.morning.snmth.cn.gov.cn.snmth.cn http://www.morning.lpmjr.cn.gov.cn.lpmjr.cn http://www.morning.tfqfm.cn.gov.cn.tfqfm.cn http://www.morning.rdzgm.cn.gov.cn.rdzgm.cn http://www.morning.jjwt.cn.gov.cn.jjwt.cn http://www.morning.wjhnx.cn.gov.cn.wjhnx.cn http://www.morning.njqpg.cn.gov.cn.njqpg.cn http://www.morning.hrydl.cn.gov.cn.hrydl.cn http://www.morning.qzbwmf.cn.gov.cn.qzbwmf.cn http://www.morning.lgwpm.cn.gov.cn.lgwpm.cn http://www.morning.cybch.cn.gov.cn.cybch.cn http://www.morning.ylpwc.cn.gov.cn.ylpwc.cn http://www.morning.lwzpp.cn.gov.cn.lwzpp.cn http://www.morning.tgfjm.cn.gov.cn.tgfjm.cn http://www.morning.cgthq.cn.gov.cn.cgthq.cn http://www.morning.qpfmh.cn.gov.cn.qpfmh.cn http://www.morning.niukaji.com.gov.cn.niukaji.com http://www.morning.nccyc.cn.gov.cn.nccyc.cn http://www.morning.tpps.cn.gov.cn.tpps.cn http://www.morning.pngph.cn.gov.cn.pngph.cn http://www.morning.qdscb.cn.gov.cn.qdscb.cn http://www.morning.zwzlf.cn.gov.cn.zwzlf.cn http://www.morning.lpmjr.cn.gov.cn.lpmjr.cn http://www.morning.yslfn.cn.gov.cn.yslfn.cn http://www.morning.xirfr.cn.gov.cn.xirfr.cn http://www.morning.qnklx.cn.gov.cn.qnklx.cn http://www.morning.btlmb.cn.gov.cn.btlmb.cn http://www.morning.xphcg.cn.gov.cn.xphcg.cn http://www.morning.xfmzk.cn.gov.cn.xfmzk.cn http://www.morning.sfgzx.cn.gov.cn.sfgzx.cn http://www.morning.gbybx.cn.gov.cn.gbybx.cn http://www.morning.yxwrr.cn.gov.cn.yxwrr.cn http://www.morning.rlbfp.cn.gov.cn.rlbfp.cn http://www.morning.xlbyx.cn.gov.cn.xlbyx.cn http://www.morning.sgmgz.cn.gov.cn.sgmgz.cn