Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
  <h4>字串</h4>
  {{ text }}
  <input type="text" class="form-control" v-model="text">
  <hr>
  <pre>{{ textarea }}</pre>
  <textarea cols="30" rows="3" class="form-control" v-model="textarea"></textarea>
  <hr>
  <h4>Checkbox 與 Radio</h4>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="check1" v-model="checkbox1">
    <label class="form-check-label" for="check1"> 要不要當我女朋友 </label>
  </div>
  <hr>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="check2" value="雞" v-model="checkboxArray">
    <label class="form-check-label" for="check2"></label>
  </div>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="check3" value="豬" v-model="checkboxArray">
    <label class="form-check-label" for="check3"></label>
  </div>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="check4" value="牛" v-model="checkboxArray">
    <label class="form-check-label" for="check4"></label>
  </div>
  <p>晚餐火鍋裡有 <strong v-for="item in checkboxArray">{{item}}</strong></p>
  <hr>
  <div class="form-check">
    <input type="radio" class="form-check-input" id="radio2" value="雞" v-model="singleRadio">
    <label class="form-check-label" for="radio2"></label>
  </div>
  <div class="form-check">
    <input type="radio" class="form-check-input" id="radio3" value="豬" v-model="singleRadio">
    <label class="form-check-label" for="radio3"></label>
  </div>
  <div class="form-check">
    <input type="radio" class="form-check-input" id="radio4" value="牛" v-model="singleRadio">
    <label class="form-check-label" for="radio4"></label>
  </div>
  <p>晚餐火鍋裡有<strong>{{singleRadio}}</strong></p>
  <hr>
  <h4>Select</h4>
  <select name="" id="" class="form-control" v-model="selected">
    <option value="" disabled>--請選擇--</option>
    <option value="校花">小美</option>
    <option value="校草">Andy</option>
  </select>
  <hr>
  <h4>MultipleSelect</h4>
  <select name="" id="" class="form-control" v-model="multiSelected" multiple>
    <option value="" disabled>--請選擇--</option>
    <option value="校花">小美</option>
    <option value="校草">Andy</option>
    <option value="妙花種子">John</option>
  </select>
  <span>選中結果:{{multiSelected}}</span>
</div>
<script>
var app = new Vue({
  el: '#app',
  data: {
    text: '',
    textarea: '',
    checkbox1: false,
    checkboxArray: [],
    singleRadio: '',
    selected: '',
    multiSelected:[]
  },
});
</script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
chun-wenpro
0viewers