所以,我试图从中获得我的主导颜色。但我经常会犯这样的错误:
以下是我从中获取的代码
var ColorThief = require('colorthief');
// if I don't include this I will get an error that resolve is not defined
const { resolve } = require('path');
const setMarker = ({ data }) => {
// this returns a string with the
具有以下.js文件:
var MyClass = function() {
};
MyClass.prototype = function myMethod(name) {
// my statements here...
// name is undefined here, but who calls this function and why?
return {
myMethod: myMethod
};
}();
和一页载入它的页面:
<head>
...
<script src="myfile.
我有一页要花很长时间才能载入。
原因是js脚本代码。
我将其设置为异步加载,但没有帮助。
有办法这样做吗?(在脚本中,我还从视图中引用了模型。)
PageView:
@section Scripts{
<script>
//Lots of code with functions and references to DOM and AJAX
</script>
}
_Layout:
@if (IsSectionDefined("Scripts"))
{
@await RenderSectionAsync("