我正在尝试将数据 URI 转换为图像数据,但遇到此错误:
无法在“窗口”上执行“atob”:要解码的字符串未正确编码
功能:
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(',');
var mime = arr[0].match(/:(.*?);/)[1];
var bstr = window.atob(arr[1]);
var n = bstr.length;
var u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {
type: mime
});
}
Run Code Online (Sandbox Code Playgroud)
数据网址是:
SRC =“数据:图像/ PNG; BASE64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAgAElEQVR4Xmy9edRl6VXe95z5nHvuvd9Uc5W6q9WSWiOSGISEmCQmx2ZKCAtjsryygv9JVsY / SGwSRw54GezYBiHANEkV7WeKQBWriul64VufPLj2vMCbSUTqQU5OAPx2lIl + S0qZWAskN2jLhaZ5ioaZRZBgMbG1AL ...
我已经编写了一个简单的应用程序来学习Nodejs,但是当我在cmd中运行“ nodemon index.js”时出现此错误TypeError:无法读取未定义应用程序的属性'push'崩溃-等待文件更改,然后再开始...
我已经按照udemy课程中的所有说明学习了nodejs,并且在将文件分为两个文件index.js和genres.js时遇到了这个问题。
genres.js
const express = require('express');
const router = express.Router;
//simple data
const genres = [{
id: 1,
name: 'course1'
},
{
id: 2,
name: 'course2'
},
{
id: 3,
name: 'course3'
}
];
//////////////////////////////////////////////////////////////////////
/////////////////////////////////// Get //////////////////////////////
//////////////////////////////////////////////////////////////////////
router.get('/', (req, res) => {
res.send(genres);
});
router.get('/:id', (req, res) => {
const genre = genres.find(c => c.id ===
parseInt(req.params.id)); //req.params.id return string
if (!genre)
return res.status(404).send('The course is not found...');
res.send(genre);
res.send(req.params.id);
});
router.get('/:year/:month', (req, res) => …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Primeng 选择列表,当我尝试将一个项目从列表拖动到另一个列表时,该项目会消失,直到该项目掉落。
<p-dialog [(visible)]="showMarker" (onHide)="hideDialogChild()" [contentStyle]="{'overflow':'visible'}" header="'Marker List'" [modal]="true">
<p-pickList [source]="sourceMarkers" [target]="targetMarkers" sourceHeader="Available markers" targetHeader="Associated Markers" dragdrop="true"
[responsive]="true" [sourceStyle]="{'height':'300px'}" [targetStyle]="{'height':'300px'}" filterBy="markername"
sourceFilterPlaceholder="Search by name" targetFilterPlaceholder="Search by name">
<ng-template let-marker pTemplate="item">
<div class="product-list-detail">
<h5 class="mb-2">{{markername}}</h5>
</div>
</ng-template>
</p-pickList>
</p-dialog>
Run Code Online (Sandbox Code Playgroud)
此链接是一个快照视频,用于显示当前行为选择列表问题
这是 stackblitze 上的运行代码: 选择器问题的代码片段
我想通过使用任何列(例如“标题”或“开始日期”或“可见”等)在此表中进行过滤或搜索,现在我的代码通过第一个列“标题”进行搜索,但我无法使其在所有列 https://datatables 中进行搜索。 net/examples/data_sources/dom.html这正是我想要的
<div>
<label>
Search:<input type="text" id="Search" onkeyup="myFunction()" placeholder="search for performance">
</label>
</div>
<table id="PerformanceTable" class="table table-bordered table-striped">
<tr>
<th>
Title
</th>
<th>
Start Date
</th>
<th>
Booking
</th>
<th>
Visible
</th>
<th>
Featured
</th>
<th>
Event
</th>
<th>
@Html.DisplayNameFor(model => model.Views)
</th>
<th></th>
</tr>
</table>
<script>
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("Search");
filter = input.value.toUpperCase();
table = document.getElementById("PerformanceTable");
tr = table.getElementsByTagName("tr");
// Loop through all table …
Run Code Online (Sandbox Code Playgroud)