我仿写它自带的脚本怎么不行,为啥它赋值就没提示未解析的变量类型,我赋值就提示
<template>
<div class="hello">
<h1>{{ msg }}h1>
<img alt="Vue logo" src="../assets/logo.png">
<h2>{{message}}h2>
<h3>{{time}}h3>
div>
template>
<script>
import { ref } from 'vue'
export default {
name: 'HelloWorld',
props: {
msg: String
},
setup () {
const message = ref('Vue3.0的欢迎信息')
return {
message
}
},
Time () {
const time = ref(Date.now())
return {
time
}
}
}
script>
<style scoped lang="scss">
h2 {
margin: 40px 0 0;
color: #000;
}
style>
哥们,你message都return了,为什么不把定义的Time方法也return了呢
定义的变量和方法都需要在setup中return出去才可以使用
在Vue中,可以在