1. 全局安装@vue/cli-service-global

    1
    $ yarn global add @vue/cli-service-global
  2. 编写单文件example.vue

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <template>
    <div id="app">
    {{ message }}
    </div>
    </template>
    <script>
    export default {
    data: function() {
    return {
    message: 'Hello Vue!'
    }
    }
    }
    </script>
    <style scoped>
    div {
    background-color: red;
    }
    </style>
  1. 跑起来

    1
    $ vue serve example.vue

Reference