SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
  el: '#app',
  data: {
    sku: 'asdf'
  },
  methods: {},
  mounted () {
    JsBarcode("#barcode", "150011", {
      lineColor: '#5c4084',
      height: 30,
      displayValue: true
    });
  }
});
<div class="heading">
  <h1>JS 条形码</h1>
  <h4>基于 JsBarcode, Vue.js 实现</h4>
</div>

<div class="container" id="app">
  
  <div class="form-group">
    <svg id="barcode" :value="sku"></svg>
  </div>
  
  <hr>
  
  <p><a href="https://github.com/lindell/JsBarcode" target="_blank"><span class="fa fa-github"></span> JsBarcode</a></p>
</div>
$purple: #5c4084;

body {
  background-color: $purple;
  padding: 50px;
}
a {
  color: #ccc;
}
.container {
  padding: 40px 80px 15px 80px;
  background-color: #fff;
  border-radius: 8px;
  max-width: 800px;
  text-align: center;
}
.heading {
  text-align: center;
  h1 {
    background: -webkit-linear-gradient(#fff, #999);
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    text-align: center;
    margin: 0 0 5px 0;
    font-weight: 900;
    font-size: 4rem;
    color: #fff;
  }
  h4 {
    color: lighten(#5c3d86,30%);
    text-align: center;
    margin: 0 0 35px 0;
    font-weight: 400;
    font-size: 24px;
  }
}
.btn{
  outline: none !important;
}
.btn.btn-primary {
  background-color: $purple;
  border-color: $purple;
  outline: none;
  &:hover {
    background-color: darken($purple, 10%);
    border-color: darken($purple, 10%);
  }
  &:active, &:focus {
    background-color: lighten($purple, 5%);
    border-color: lighten($purple, 5%);
  }
  & .fa {
    padding-right: 4px;
  }
}
.form-group {
  margin-bottom: 25px;
}

本项目引用的自定义外部资源