<template>
  <div class="fit" id="list">
    <div id="id1">{{ msg }}</div>
    <div id="id2">2</div>
    <div id="id3">3</div>
  </div>
</template>
<script lang="ts">
export default {
  name: 'PAGE3',
};
</script>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
// import { LinkedList } from './linkedList';
import { LinkedList2 } from './doublyLinkedList';
const msg = ref('page3');

onMounted(() => {
  // 创建两个列表节点
  // let node1 = new ListNode(2);
  // let node2 = new ListNode(5);
  // node1.next = node2;
  // console.log('列表节点', node1);
  // 用node1创建一个链表
  // let list = new LinkedList(node1);
  // console.log('链表', list);
  // console.log(list.head.next.data); // 5
  // console.log('list的size', list.size()); // 2
  // list.clear();
  // console.log('清空链表', list);
  // console.log('链表的最后一个节点', list.getLast());
  // console.log('链表的第一个节点', list.getFirst());

  let list = new LinkedList2(1);
  list.append(2);
  list.append(3);
  console.log('插入前', list.toArr()); // [1, 2, 3]
  list.insert(2, 4);
  console.log('插入后', list.toArr()); // [1, 2, 4, 3]
});
</script>

<style lang="scss" scoped></style>
