其他分享
首页 > 其他分享> > vue学习-003

vue学习-003

作者:互联网

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .a{
            color:red;
        }
        .b{
            font-size:16px;
        }
        .x{
            font-size:20px;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1>{{message}}</h1>
        <img :title="img_title" v-bind:src="img_url">
        <h1 :class="'a' + ' ' + 'b'">HAHA</h1>
        <h1 :class="[arg1,arg2]">HAHA</h1>
        <h1 :class="arg1">HAHA</h1>
        <h1 :class="{arg1:true,arg2:true}">HAHA</h1>
        <h1 :class="{a:true,b:true}">HAHA</h1>
        <h1 class="x" :class="{a:arg1_flag,b:arg2_flag}">HAHA</h1>
        <h1 :class="getClass()">HAHA</h1>
        <p>----------------------------------------------------</p>
        <h1 :style="{fontSize:'50px'}">XIXI</h1>
        <h1 :style="{fontSize: v50}">XIXI</h1>
    </div>
    <script>
        const app = Vue.createApp({
                data() {
                    return {
                        message: 'Mr.Door',
                        img_url: 'https://img-home.csdnimg.cn/images/20201124032511.png',
                        img_title: 'csdn',
                        arg1: 'a',
                        arg2: 'b',
                        arg1_flag: true,
                        arg2_flag: 0,
                        v50: '50px'
                    }
                },
                methods: {
                    getClass() {
                        return {a : this.arg1_flag, b : this.arg2_flag}
                    }
                }
            }).mount('#app')
    </script>
</body>
</html>

标签:学习,vue,img,arg1,arg2,HAHA,003,flag,app
来源: https://www.cnblogs.com/MayflyCHG/p/15571990.html