The problem of referencing CDN.
The following CDNs don't work. Why? I just want to use the CDN of jsdelivr, because only jsdelivr has Chinese CDN.
<script src="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-lists.min.js"></script>
The following CDNs can be used normally.
<script src="//cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script>
All codes
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 2</title>
<link rel="stylesheet" rel='nofollow' href="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css">
<link rel="stylesheet" rel='nofollow' href="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css">
<script src="//cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script>
</head>
<body>
<!-- Add the HTML <div> element -->
<div id='element'></div>
<script>
//define the array of string
var arts = ["Artwork", "Abstract", "Modern Painting", "Ceramics", "Animation Art", "Oil Painting"];
// Initialize Essential JS 2 JavaScript ListView control
var listviewInstance = new ej.lists.ListView({
//set the data to datasource property
dataSource: arts
});
//Render initialized ListView
listviewInstance.appendTo("#element");
</script>
</body>
</html>
|
<html><head><link rel="stylesheet" rel='nofollow' rel='nofollow' href=https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css>
<link rel="stylesheet" rel='nofollow' rel='nofollow' href=https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css>
<script src=https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-base.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-data.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-lists.min.js></script>
</head>
<body>
<div id='element'></div>
</body></html> |
It seems that JS files must be in order? base>data>lists
If data is put to the end, it can't run? In the following example, I didn't mention the use of data.js, so I didn't put it, so I couldn't run it. Should I read the tutorial on this website?
https://ej2.syncfusion.com/javascript/documentation/listview/getting-started/
<!--1-->
<link rel="stylesheet" rel='nofollow' href="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css">
<!--2-->
<link rel="stylesheet" rel='nofollow' href="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/styles/material.css">
<!--3-->
<script src="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-base.min.js"></script>
<!--4-->
<script src="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-data.min.js"></script>
<!--5-->
<script src="https://cdn.jsdelivr.net/npm/@syncfusion/[email protected]/dist/global/ej2-lists.min.js"></script>