尼采般地抒情

尼采般地抒情

尼采般地抒情

音乐盒

站点信息

文章总数目: 313
已运行时间: 1541

使用

安装:npm install -g typescript

编译:tsc helloworld.ts

报错:tsc : 无法加载文件···

如果报如下错:

tsc : 无法加载文件 D:\Program Files\nodejs\tsc.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink
  1. 管理员身份运行vs code
  2. 在终端执行:get-ExecutionPolicy,显示Restricted
  3. 在终端执行:set-ExecutionPolicy RemoteSigned
  4. 在终端执行:get-ExecutionPolicy,显示RemoteSigned

nodemon运行ts文件

  1. 本地全局下载nodemonts-nodetypescript三个模块
npm i nodemon ts-node typescript -g
  1. 在ts文件根文件夹下执行
tsc --init
  1. 运行ts文件
nodemon test.ts

tsconfig.json

ts遍历对象

ts遍历对象不要使用for···in,使用for···of

const disabled = computed(() => {
  let flag = true
  for (const [key, val] of Object.entries(formState)) {
    if (!val) {
      flag = true
      break
    } else {
      flag = false
    }
  }
  return flag
})


参考

学习网站:

相关教程:

评论区