Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
662 views
in Technique[技术] by (71.8m points)

安装vue-cli4.0时加入typeScript,但是写代码的时候报错了

安装vue-cli4.4.4的时候,问我是否安装ts,我选择了是。为了验证能否用ts,我加入了这行代码 然后就报错了

<script>
export default {
    data () {
        return {

        }
    },
    mounted(){
        let isDone: boolean = false;
    }
}
</script>

image.png

我百度了下,let isDone: boolean = false;确实是ts的语法

ts目录是vue-cli自动帮我配的,所以这就很奇怪,为什么会报错呢?
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
<script lang="ts">

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...