您好,我目前正在尝试将Summernote编辑器添加到Vue2 Js项目中,但如果通过外部URL链接,则只能对其进行管理,如果我尝试在本地链接相同的文件,则操作不正确加载库。 错误:
vue.common.js?e881:593 [Vue警告]:挂接的钩子中出现错误:“ TypeError: $(...)。summernote不是函数”
位于
---> 在src \ views \ Documents \ EditDocument.vue 在src \ components \ Dashboard \ Layout \ Content.vue 在src \ components \ Dashboard \ Layout \ DashboardLayout.vue 在src \ App.vue 警告@ vue.common.js?e881:593 logError @ vue.common.js?e881:1739 globalHandleError @ vue.common.js?e881:1734 handleError @ vue.common.js?e881:1723 callHook @ vue.common.js?e881:2925插入@ vue.common.js?e881:4160 invokeInsertHook @ vue.common.js?e881:5962补丁@ vue.common.js?e881:6181 Vue._update @ vue.common.js?e881:2672 updateComponent @ vue.common.js?e881:2790获取@ vue.common.js?e881:3144运行@ vue.common.js?e881:3221 flushSchedulerQueue @ vue.common.js?e881:2983(匿名)@ vue.common.js?e881:1839 flushCallbacks @ vue.common.js?e881:1760 vue.common.js?e881:1743 TypeError:$(...)。summernote不是函数 在VueComponent.mount(Summernote.js?f9ca:45) 在callHook(vue.common.js?e881:2923) 在Object.insert(vue.common.js?e881:4160) 在invokeInsertHook(vue.common.js?e881:5962) 在VueComponent.patch [作为补丁](vue.common.js?e881:6181) 在VueComponent.Vue._update(vue.common.js?e881:2672) 在VueComponent.updateComponent(vue.common.js?e881:2790) 在Watcher.get(vue.common.js?e881:3144) 在Watcher.run(vue.common.js?e881:3221) 在flushSchedulerQueue(vue.common.js?e881:2983)
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="apple-touch-icon" sizes="76x76" href="static/img/apple-icon.png">
<link rel="icon" type="image/png" sizes="96x96" href="static/img/favicon.png">
<link rel="stylesheet" type="text/css" rel="stylesheet" href="static/css/font-awesome-4.4.0.css"/>
<link rel="stylesheet" type="text/css" rel="stylesheet" href="static/css/bootstrap-3.3.5.css"/>
<link rel="stylesheet" type="text/css" rel="stylesheet" href="static/css/summernote-0.8.1.css"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Portal - Admin</title>
<!-- Bootstrap core CSS -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- Fonts and icons -->
<link type="text/css" href="https://fonts.googleapis.com/css?family=Muli:400,300" rel="stylesheet">
<link type="text/css" href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="/static/css/themify-icons.css" rel="stylesheet">
</head>
<body>
<div class="wrapper" id="app">
</div>
<script type="text/javascript" src="static/js/jquery.js"></script>
<script type="text/javascript" src="static/js/bootstrap.js"></script>
<script type="text/javascript" src="static/js/summernote.js"></script>
<script type="text/javascript" src="static/js/test.js"></script>
<!-- built files will be auto injected -->
</body>
</html>
如果JQuery,Summernote和Bootstrap通过CDN的URL链接到相同的文件,则可以正常工作(与顶部的CSS文件相同)。 如果需要,可以提供更多信息。
先谢谢了。