• vue中的bind


    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Document</title>
    	<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
    </head>
    <body>
    
    	<div id="comp">
    		<p>{{msg}}</p>
    		<p>{{msg.split('')}}</p>
    		<p>{{ msg.split('').reverse()}}</p>
    		<p>{{ msg.split('').reverse().join()}}</p>
    		<p>{{ msg.split('').reverse().join('')}}</p>
    
    		<p>{{ reverseStr }}</p>
    		<button @click='clickHandel'>更改</button>
    	</div>
    
    
    	<form id="okk" action="">
    		<h5>单行文本:</h5>
    		<input type="text" v-model="msg" placeholder="请输出用户名">
    		<input type="number" v-model="msg">
    		<p>{{msg}}</p>
    
    		<h5>多行文本</h5>
    		<textarea name="" id="" cols="30" rows="10" v-model="msg2"></textarea>
    		<p>{{msg2}}</p>
    		<h5>单个复选框</h5>
    		<input type="checkbox" v-model="checked">
    		<label for="checkbox">{{checked}}</label>
    		<h5>多个复选框</h5>
    		<input type="checkbox" value="读书" v-model="checkedNames">
    		<label for="">读书</label>
    		<input type="checkbox" value="音乐" v-model="checkedNames">
    		<label for="">音乐</label>
    		<input type="checkbox" value="旅游" v-model="checkedNames">
    		<label for="">旅游</label>
    		<p>Checked names: {{ checkedNames }}</p>
    		<h5>单选按钮</h5>
    		<input type="radio" value="男" v-model="radioed">
    		<label for="">男</label>
    		<input type="radio" value="女" v-model="radioed">
    		<label for="">女</label>
    		<p>{{radioed}}</p>
    		<h5>单选框</h5>
    		<select name="" id="" v-model="selected">
    			<option >python</option>
    			<option >django</option>
    			<option >web</option>
    			<option >java</option>
    		</select>
    		<p>{{selected}}</p>
    		<h5>多选框</h5>
    		<select name="" id="" v-model="mulselected" multiple>
    			<option >python</option>
    			<option >django</option>
    			<option >web</option>
    			<option >java</option>
    		</select>
    		<p>{{mulselected}}</p>
    		
    		
    	</form>
    	<h5>for循环option</h5>
    
    	<form action="" id="okk1" >
    	<select name="" v-model=mulsel>
    		<option v-for='option in options' v-bind:value="option.value">
    			{{option.text}}
    		</option>
    	</select>
    	<p>{{mulsel}}</p>
    	</form>
    
    	<script>
    
    
    		new Vue({
    			el:'#comp',
    			data:{
    				msg:'学习Vue.js',
    				text:'好好学习,天天向上',
    				text2:'python.django,vue',
    			},
    			methods:{
    				clickHandel(){
    					this.text = '阿里巴巴';
    					this.reverseStr = 'javac++'
    				}
    			},
    			computed:{
    				reverseStr:{
    					// return this.text.split('').reverse().join(''),
    					set:function (newValue) {
    						this.text2 = newValue
    					},
    					get:function () {
    						return this.text2.split('').reverse().join('');
    					}
    				}
    			},
    
    		})
    
    
    		new Vue({
    			el:'#okk',
    			data:{
    				msg:'',
    				msg1:'学习学习',
    				msg2:'Vue.js学习
    www.vue.js.com',
    				checked:'',
    				checkedNames:[],
    				radioed:'',
    				selected:'',
    				mulselected:[],
    			}
    		})
    
    		new Vue({
    			el:'#okk1',
    			data:{
    				mulsel:'vue',
    				options:[
    					{text:1,value:'vue'},
    					{text:2,value:'js'},
    					{text:3,value:'go'},
    				]
    			}
    		})
    	</script>
    	
    </body>
    </html>
    

      

  • 相关阅读:
    接口测试相关面试题
    appium报错 Unhandled rejection Error: UiAUtomator shut down unexpectedly
    几道小题
    element-ui select 二级联动
    pycharm 永久注册
    Python-二分法查找
    python3通过qq邮箱发送邮件
    IntelliJ IDEA常用快捷键总结
    IDEA工具开发一些辅助功能设置
    类百度富文本编辑器文件上传。
  • 原文地址:https://www.cnblogs.com/chvv/p/9683670.html
Copyright © 2020-2023  润新知