zl程序教程

您现在的位置是:首页 >  前端

当前栏目

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

Vue3VueJS安装 怎样 Vue2 devtools
2023-09-14 09:04:06 时间

带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>