problem description
I need to use an old third-party package in the project. This package does not depend on any package. The author mounts the required variables on window
.address of the library: http://annotorious.github.io/
this is part of the source code of the library
window.anno = new Y;
Y.prototype.activateSelector = Y.prototype.ba;
Y.prototype.addAnnotation = Y.prototype.J;
Y.prototype.addHandler = Y.prototype.addHandler;
Y.prototype.addPlugin = Y.prototype.zb;
Y.prototype.destroy = Y.prototype.destroy;
Y.prototype.getActiveSelector = Y.prototype.la;
Y.prototype.getAnnotations = Y.prototype.t;
Y.prototype.getAvailableSelectors = Y.prototype.ma;
Y.prototype.hideAnnotations = Y.prototype.ea;
Y.prototype.hideSelectionWidget = Y.prototype.N;
Y.prototype.highlightAnnotation = Y.prototype.o;
Y.prototype.makeAnnotatable = Y.prototype.xc;
Y.prototype.removeAll = Y.prototype.Sb;
Y.prototype.removeAnnotation = Y.prototype.A;
Y.prototype.reset = Y.prototype.reset;
Y.prototype.setActiveSelector = Y.prototype.sb;
Y.prototype.setProperties = Y.prototype.ga;
Y.prototype.showAnnotations = Y.prototype.Da;
Y.prototype.showSelectionWidget = Y.prototype.Z;
window.annotorious || (window.annotorious = {});
window.annotorious.plugin || (window.annotorious.plugin = {});
window.annotorious.geometry || (window.annotorious.geometry = {}, window.annotorious.geometry.expand = Dd, window.annotorious.geometry.getBoundingRect = Cd);
Y.prototype.setSelectionEnabled = Y.prototype.ke;
the environmental background of the problems and what methods you have tried
I have tried google, but most of them take the introduction of jquery as an example, and the experiment has no effect.I have referred to how to use third-party libraries in Vue.js , webpack templates how to introduce external js in the development environment , ides/shimming/-sharp-exports" rel=" nofollow noreferrer "> shimming ,
I feel that the official documentation of webpack is more reliable, but I still report an error when I try to add the following code
(annotorious.min.js
)
webpack.base.conf.js
main.js
anno
however, when using the internal method anno.makeAnnotatable ()
Times error:
[Vue warn]: Error in mounted hook: "Error: Annotorious does not support this media type in the current version or build configuration."
I have also tried to introduce it into the component, and also reported an error
import anno from "../../../static/annotorious-0.6.4/annotorious.min.js"
export default {
// ...
}