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.bootcss.com/vue/2.5.13/vue.min.js"></script>
  <script src="https://cdn.bootcss.com/vuex/3.0.1/vuex.min.js"></script>
  <script src="https://cdn.bootcss.com/vue-router/3.0.1/vue-router.min.js"></script>
</head>
<body>
  <div id="app">
    <p>{{ message }}</p>
    <button @click="visible = true">打开</button>
    <child v-show="visible" @close="visible = false"></child>
  </div> 
</body>
</html> 
 
Vue.component('child', {
  template: `
    <div>
      我是儿子
      <button @click="$emit('close')">关闭</button>
    </div>
  `
})
new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue.js!',
    visible: false,
  }
})
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers