MDN 文档

此方法需要用户手势。 否则,它返回false。

const koa2 = require(`koa2`);
const Router = require(`koa-router`);
const router = new Router();
const app = new koa2();

const Index = router.get(`/`, async (ctx, next) =>{
  await next()
  ctx.status = 200;
  ctx.type= `html`;
  ctx.body = `
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <h1 >hello2</h1>
    <script>
      document.getElementById('h').onclick = function(e){
         window.navigator.vibrate([200, 100]);
      }
    </script>
    `
}).routes();
app.use(Index);

app.listen(1995);

相关文章:

  • 2022-02-10
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-02-13
  • 2021-06-30
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2021-06-12
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2021-05-28
  • 2021-08-29
相关资源
相似解决方案