<div id="app">
<h1>{{message}}</h1>
<p v-if="seen"> 现在你能看见我 </p>
<a href="javscript:;" v-on:click="greet">{{greet_text}}</a>
<select v-bind:id="greet_select" v-model="selected" v-on:change="greetSelect">
<option value="out">出来</option>
<option value="in">回去</option>
</select>
</div>
var vm = new Vue({
el:'#app',
data:{
message:'hello vue!',
seen:false,
greet_text:'出来',
selected:"in"
},
created : function () {
},
methods:{
greet: function(event){
if(this.seen){
this.seen = false;
this.greet_text="出来";
this.selected="in";
}else{
this.seen=true;
this.greet_text="回去";
this.selected="out";
}
},
showEditProduct:function (event) {
jQuery("#edit_product").modal();
},
greetSelect:function(event){
var val = event.target.value;
if(val=='in'){
this.seen=false;
this.greet_text="出来";
}else{
this.seen=true;
this.greet_text="回去";
}
},
},
});