index.html

<!doctype html>
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    *{margin:0;padding: 0;box-sizing: border-box}
    :root{
        --button-height:32px;
        --font-size:14px;
        --font-size: white;
        --border-radius:4px;
        --button-active-bg:#eee;
        --color:#333;
        --border-color:#999;
        --border-color-hover:#666;
        --button-bg:white;
    }
    #app{
        margin: 2px;
    }
    body{
        font-size:var(--font-size)
    }
</style>
<style>
    .g-button{
        font-size:var(--font-size);
        height:var(--button-height);
        padding: 0 1em;
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        background: var(--button-bg);

    }
    .g-button:hover{
        border-color:var(--border-color-hover);
    }
    .g-button:active{
        background-color:var(--button-active-bg);
    }
</style>
<body>
<div id="app">
   <g-button class="g-button"></g-button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./button.js"></script>
<script>
new Vue({
    el:'#app',
    data:{
        message:'hi'
    }
})
</script>
</body>
</html>

button.js

Vue.component('g-button',{
    template:`
    <button>hi</button>>
    `
})

运行结果