SOURCE

console 命令行工具 X clear

                    
>
console
<script>
var goodsListJson=[  
    {goodsId:'0001',goodsName:'电脑'},  
    {goodsId:'0002',goodsName:'笔记本'}, 
    {goodsId:'0003',goodsName:'键盘'}, 
    {goodsId:'0004',goodsName:'鼠标'}, 
    {goodsId:'0005',goodsName:'显示屏'}, 
    {goodsId:'0006',goodsName:'硬盘'}, 
   
];  

export default {
	
	data:function(){
		return {
		goodsList:goodsListJson,
		searchGoodsId:'',
		List:[]
   		
      
    };
	},
	methods:{
    search:function(){
     for(var i=0;i<this.goodsList.length;i++){
    	if(this.goodsList[i].goodsId == this.searchGoodsId){
    		this.List.push(this.goodsList[i])
    		return this.List;
    	}
    }	
       console.log('aaaa');
    }
    
   
 	}
	
 }
 </script>
	 <q-btn label="查询" color="primary" size="sm"  @click="search" />

	 
    <div>商品显示:
      <ol >
        <li v-for="goods in List" >
          <p>商品编号:{{goods.goodsId}},商品名称:{{goods.goodsName}}</p>
        </li>
      </ol>
    
    </div>
    
    
</div>
  
 
</template>