我的模块
我的新Nuxt模块 做惊人的事情.
共用堆肥和提法,由 @gluhar/app安装 @nuxtjs/device。 。 。 .
useResponsive()
每一个克卢哈尔项目都有一个断点 它取代了项目一级 useMobile 副本.
只针对行为 ——事件处理器,GSAP/ScrollTrigger设置,测量. 响应式布局是模板中的 Tailwind 变体; 从不将宽度旗放入 v-if 编号 : :class。 。 。 .
const { isMobileDevice, mounted, mobile, tablet, desktop, touch, up, down, between } =
useResponsive();
const nav = up("nav"); // any --breakpoint-* the project declares
onMounted(() => {
if (desktop.value) initParallax(); // already correct here
});
| 来源 | 在服务器上 | 安全标记 | |
|---|---|---|---|
isMobileDevice | 用户代理 | 实际值 | 是的,但它是一个设备猜测,不是宽度 |
mobile tablet desktop wide touch tabletExact desktopExact up() down() between() | 视图宽度 | false | 没有 |
- 保持宽旗
false通过第一次水合使服务器和客户端达成一致,然后在可堆肥的自身开关onMounted——在任何情况下onMounted打电话后登记。 水合后创建的组件立即获得活值. - 断点是项目的
--breakpoint-*CSS 值( 由@gluhar/theme),默认为tablet768页/desktop1200页/wide2000 (英语). >=比较, 如 CSSmin-width数字 :tablet财务报告和审定财务报表tablet:同意每个宽度,包括768.mobile=以下(单位:千美元)tablet· ;touch=以下(单位:千美元)desktop(宽度,不是触摸能力).
发展
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release