1. type assertion expressions can only be used in TypeScript files.Vetur(8016)
解决方案:在<script>
标签上加lang="ts"
<script lang="ts">
</script>
2.类型“string | null”的参数不能赋给类型“string”的参数。不能将类型“null”分配给类型“string”。
JSON.parse(localStorage.getItem('list'))
JSON.parse方法是json字符串转换为json对象,使用localStorage.getItem
获取的值是null
解决方案:在<script>
标签上加lang="ts"
JSON.parse(localStorage.getItem('list') || '[]')