vue3在单页面使用

  • 引入 vue.js
  • 引人 element-plus
  • 引入 axios.js
<!DOCTYPE html>
<html lang="zh-ch">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue3Demo</title>

    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.45/vue.global.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/element-plus/2.2.28/index.css" rel="stylesheet" />

    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.2.5/axios.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/element-plus/2.2.28/index.full.js"></script>
</head>

<body>
    <div id="hello-vue">
        <h1>{
    
    {
    
    msg}}</h1>
        <el-button type="primary" @click="changeMsg">Primary</el-button>
    </div>
</body>

<script>
    const HelloVueApp = {
    
    
        data() {
    
    
            return {
    
    
                msg: "LLT123"
            }
        },
        methods:{
    
    
            changeMsg(){
    
    
                this.msg
            } 
        }
    }
    Vue.createApp(HelloVueApp).use(ElementPlus).mount('#hello-vue')
</script>

</html>

猜你喜欢

转载自blog.csdn.net/Linlietao0587/article/details/128975110
今日推荐