怎样安装vue2和vue3的Vue.js devtools

带beta的是vue3的

下面那个干净的vue图标的是vue2的

下面创建一个vue3的简单项目看看:

代码:

<template>
  <div class="hello">
    <h1>一个人的信息</h1>
    <h2>姓名:{
   
   {name}}</h2>
    <h2>年龄:{
   
   {age}}</h2>
    <button @click="sayHello">说话</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  setup(){
    let name='张三'
    let age = 18
    function sayHello(){
      alert(`我叫${name},我${age}岁了,你好啊!`)
    }
    return{
      name,
      age,
      sayHello
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

猜你喜欢

转载自blog.csdn.net/qq_22182989/article/details/125247542
今日推荐