<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>
    <input type="text" id="inputNums" placeholder="请输入数字，以逗号分隔">
<button type="button" onclick="bubbleSort()">排序</button>
<p id="outputNums"></p>

  </header>

  <main>
    <TheWelcome />
  </main>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
