繁体   English   中英

require.config 不是 .js 文件中的函数

[英]require.config is not a function in .js file

我正在使用 .js 文件,我刚刚使用了代码,我发现了错误

require.config 不是一个函数 我可以为此做什么? 请帮帮我!

代码在这里

require.config({
  paths: {
    'mobiledetect': 'https://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.4.4/mobile-detect.min'
  }
});
require(['mobiledetect'], function (MobileDetect) {
  var detector = new MobileDetect(window.navigator.userAgent)

  console.log("Mobile: " + detector.mobile());
  console.log("Phone: " + detector.phone());
  console.log("Tablet: " + detector.tablet());
  console.log("OS: " + detector.os());
  console.log("userAgent: " + detector.userAgent());

});

最好的问候,帕雷什帕瓦尔

你想做什么?
Javascript 没有名为 require 的本机模块
也许你需要安装一个依赖项才能工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM