1 Introduction
jTopo (Javascript Topology library) is a relationship based entirely on HTML5 Canvas, and topology graphical interface development kit. Its small size, high performance, be maintained by a group of hobbyists. The only feeling inadequate is that it is a pure js
library, did not like the use of ES6
grammar, modular development can not be used like import
import,
Because bloggers are using vue-cli project to build a modular development project, we want to use third-party libraries are the best way through npm install xxx
the installation, and then in the project import xxx
to use. But in the JTopo
official website and did not find the library npm
package, in www.npmjs.com
the search JTopo
, although the library to find the npm
package, but some of these packages are made by individual developers to modify the source code to upload, and the number of years too long, bloggers fear directly use of the words may be some strange bug
, so bloggers study a little, how to vue-cli
import third-party direct project js
libraries, fortunately, we found a way to quickly and easily Ha, the method will now record, and provide demo, for your reference.
2. Solution
We know that, no matter what the project, the final package by running in the browser is certainly a html
file in Vue
the root directory is index.html
, will be in the file webpack
after the package build.js
files <script>
into the label manner, in that case, we dare imagine, we can assume jtopo.js
that webpack
packaged the output file, we have to manually index.html
file by <script>
is not ready to use it the way into the label. Through the experiment, literally.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JTopoInVue</title>
</head>
<body>
<div id="app"></div>
<script src="/lib/jtopo-0.4.8-min.js"></script>
<script src="/dist/build.js"></script>
</body>
</html>
After this introduction, we can follow the project jtopo
as an official document of the library use it. demo here Mengchuo
3. deficiencies at
jtopo
Official website also provides a toolbar, the toolbar functionality is toolbar.js
implemented, and the js
file inside relied jQuery
, so in order to use the toolbar in the project must be installed jQuery
, and the bloggers do not use the toolbar in the project, so there is no continuing research in this area if there is little demand partners can use their own research.
(Finish)