mirror of
https://gitee.com/coder-xiaomo/algorithm-visualization
synced 2025-01-10 11:48:18 +08:00
修复数组为空Bug弹窗
This commit is contained in:
parent
92b7ef448f
commit
fd0794158d
@ -59,13 +59,14 @@ class ArrayVi extends ViBase {
|
||||
if (!sortClassInfo['available'])
|
||||
continue
|
||||
|
||||
let that = this
|
||||
let ctrlBtn = document.createElement("button")
|
||||
ctrlBtn.innerHTML = sortClassInfo['name']
|
||||
ctrlBtn.onclick = function () {
|
||||
// 点击排序算法按钮
|
||||
// if (!updateListDataArray(elementId, { doNotAlert: false }))
|
||||
// if (!that.updateListDataArray(elementId, { doNotAlert: false }))
|
||||
// return
|
||||
if (!this.listData || this.listData.length == 0) {
|
||||
if (!that.listData || that.listData.length == 0) {
|
||||
alert("数组为空")
|
||||
return
|
||||
}
|
||||
@ -135,6 +136,7 @@ class ArrayVi extends ViBase {
|
||||
|
||||
// 绘制数组
|
||||
initArray(elementId, listData) {
|
||||
console.log("initArray")
|
||||
let fragment = shape.getLinkedListFragment(elementId, listData, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
|
@ -25,7 +25,7 @@
|
||||
<label>
|
||||
请输入数组元素,以逗号分隔(中英文逗号均可)
|
||||
<input id="array-input" style="width: 100%; text-align: center;" type="text" value="" />
|
||||
</label>
|
||||
</label>
|
||||
<input id="getRandomBtn" type="button" value="随便来一个" />
|
||||
</div>
|
||||
<!-- 排序算法按钮 -->
|
||||
|
Loading…
Reference in New Issue
Block a user