Skip to content

Instantly share code, notes, and snippets.

@anakahala
Last active August 29, 2015 13:56
Show Gist options
  • Save anakahala/9248889 to your computer and use it in GitHub Desktop.
Save anakahala/9248889 to your computer and use it in GitHub Desktop.
Vue.jsでボタン活性非活性
<!doctype html>
<html>
<head>
<title>Button Disabled By Vue.js</title>
<meta charset="utf-8">
</head>
<body>
<h2>Button Disabled By Vue.js</h2>
<div id="app">
<div>
<input v-model="agree" type="checkbox" />利用規約に同意します
<button v-attr="disabled: !agree">Submit</button>
</div>
<div>
<input v-model="textValue" />
<button v-attr="disabled: textValue == ''">Submit</button>
</div>
</div>
<script src="js/vue.min.js"></script>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
agree: false,
textValue: ''
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment