第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

代碼如下,預(yù)期功能是輸入為空的情況下提交按鈕無法點(diǎn)擊,使用計(jì)算屬性返回布爾變量進(jìn)行控制,但是實(shí)際使用時(shí)有值的情況下也無法點(diǎn)擊,是哪里出了問題呢

<!DOCTYPE html>
<html>
<head>
??? <meta charset="UTF-8">
??? <title>todolist</title>
??? <script src="vue.js"></script>
</head>

<body>
<div id="root">
???? <div>
???? <input v-model="inputValue"/>
???? <button disabled="loginId" v-on:click="handleClick">Enter</button>
?? ? </div>
???? <ul>
???? <li v-for="(item,index) of list":key="index">
???? {{item}}
???? </li>
???? </ul>
</div>


<script>
??? new Vue({
??????? el: '#root',
??????? data:{
??????? inputValue:'',
??????? list:[]
??????? },
??????? methods:{
??????? handleClick:function(){
??????? this.list.push(this.inputValue)
??????? inputValue=''
??????? }
??????? },
?? ??? ?computed: {
??????? isLogin() {
??????? return !!inputValue
??? }
}
??? })
</script>
</body>
</html>

正在回答

2 回答

<!DOCTYPE html>

<html>

<head>

? ? <meta charset="UTF-8">

? ? <title>todolist</title>

? ? <script src="vue.js"></script>

</head>


<body>

<div id="root">

? ? ?<div>

? ? ?<input v-model="inputValue"/>

? ? ?<button :disabled="!inputValue" v-on:click="handleClick">Enter</button>

? ? ?</div>

? ? ?<ul>

? ? ?<li v-for="(item,index) of list" :key="index">

? ? ?{{item}}

? ? ?</li>

? ? ?</ul>

</div>



<script>

? ? new Vue({

? ? ? ? el: '#root',

? ? ? ? data:{

? ? ? ? inputValue:'',

? ? ? ? list:[]

? ? ? ? },

? ? ? ? methods:{

? ? ? ? handleClick:function(){

? ? ? ? this.list.push(this.inputValue)

? ? ? ? inputValue=''

? ? ? ? }

? ? ? ? }

? ? });

</script>

</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

云爆雷聲 提問者

很有用,謝謝!
2018-05-24 回復(fù) 有任何疑惑可以回復(fù)我~
<!DOCTYPE?html><html><head>????<meta?charset="UTF-8">????<title>todolist</title>????<script?src="vue.js"></script></head><body><div?id="root">?????<div>	?????<input?v-model="inputValue"/>	?????<button?:disabled="!inputValue"?v-on:click="handleClick">Enter</button>?????</div>?????<ul>?????<li?v-for="(item,index)?of?list"?:key="index">?????{{item}}?????</li>?????</ul></div><script>????new?Vue({????????el:?'#root',????????data:{	????????inputValue:'',	????????list:[]????????},????????methods:{	????????handleClick:function(){		????????this.list.push(this.inputValue)		????????inputValue=''	????????}????????}????});</script></body></html>

沒用computed,這樣就可以了.

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

代碼如下,預(yù)期功能是輸入為空的情況下提交按鈕無法點(diǎn)擊,使用計(jì)算屬性返回布爾變量進(jìn)行控制,但是實(shí)際使用時(shí)有值的情況下也無法點(diǎn)擊,是哪里出了問題呢

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號