支持

Framework7 还附带了功能检测库。

该属性可以用作 Framework7 类的 support 属性(Framework7.support)和已初始化应用程序实例的同名属性(app.support)。

// If we need it in place where we don't have access to app instance or before we init the app
if (!Framework7.support.touch) {
  console.log('No touch support');
}


// After we init the app we can access it as app instance property
var app = new Framework7({ /*...*/ });

if (!app.support.touch) {
  console.log('No touch support');
}

getSupport

如果使用 ES 模块结合 Framework7,则相反地需要使用 getSupport 实用程序。

import { getSupport } from 'framework7';

const support = getSupport();

if (!support.touch) {
  console.log('No touch support');
}

支持属性

touch触摸事件支持(touchstart、touchmove、touchend)
pointerEvents指针事件支持
intersectionObserverIntersection Observer 支持
passiveListener被动事件监听器支持