Thu May 18 15:11:00 UTC 2023 inscode

上级 4f39fc67
<script setup>
import HelloWorld from './components/HelloWorld.vue'
import TheWelcome from './components/TheWelcome.vue'
function bubbleSort() {
let nums = document.getElementById("inputNums").value.split(",");
for (let i = 0; i < nums.length; i++) {
for (let j = 0; j < nums.length - i - 1; j++) {
if (parseInt(nums[j]) > parseInt(nums[j + 1])) {
let temp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = temp;
}
}
}
document.getElementById("outputNums").innerHTML = nums.join(", ");
}
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
<input type="text" id="inputNums" placeholder="请输入数字,以逗号分隔">
<button type="button" onclick="bubbleSort()">排序</button>
<p id="outputNums"></p>
<div class="wrapper">
<HelloWorld msg="You did it!" />
</div>
</header>
<main>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册