javascript - 在 vue3 组件中导入 bower 组件 - WEBPACK_IMPORTED_MODULE_1_.Timetable 不是构造函数
问题描述
我想在我的 Vue3 组件中使用外部库“时间表”(http://timetablejs.org/ )。
我的组件:
<script>
import axios from 'axios';
import { Timetable } from '../../bower_components/timetable.js/dist/scripts/timetable.js'
export default {
name: 'Planning',
data() {
return {}
},
mounted: function(){
var timetable = new Timetable();
}
}
</script>
<style>
@import '../../bower_components/timetable.js/dist/styles/timetablejs.css';
</style>
<template>
<div>
<div class="timetable"></div>
</div>
</template>
当我想创建一个新的时间表时,我有一个错误:
未捕获(承诺)类型错误:bower_components_timetable_js_dist_scripts_timetable_js__WEBPACK_IMPORTED_MODULE_1_.Timetable 不是构造函数
我无法用 npm 安装库,我用 bower 安装了它。如何将这个 bower 组件与我的 Vue3 组件一起使用?
解决方案
推荐阅读
- javascript - 为什么在 Google Script 中由时间驱动触发器执行时函数参数的值未定义?
- http - 在 cache-Control 标头字段中,为什么将其命名为“指令”?
- arrays - 在视图控制器屏幕上放置一个空的图像视图数组
- php - 为什么我的 PHP 代码看不到 $_SERVER['PHP_SELF']?
- c# - 固定2D控制器的坡度运动(Unity)
- google-apps-script - 如何从 Google Apps 脚本发布 Google 幻灯片演示文稿?
- python-3.x - 格兰杰因果检验返回值错误
- python - FileNotFoundError:找不到模块“libvlc.dll”
- mysql - 与他人共享数据库
- jquery - 使用 jQuery 重新加载页面后如何保存 CSS 值?