支持

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

当我们使用 Framework7 与 ES 模块时,我们需要使用getSupportutil 而不是:

import { getSupport } from 'framework7';

const support = getSupport();

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

支持属性

touch触摸事件支持 (touchstart, touchmove, touchend)
pointerEvents指针事件支持
intersectionObserver交叉观察者支持
passiveListener被动事件监听器支持