//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
// class arrayFun{
// // your code here
// //你需要实现以下方法: map/filter/delay/forEach
// constructor(data){
// this.dataArray = data
// }
// filter(data){
// setInterval(()=>{
// for(let n=0;n<this.dataArray.length;i++){
// if(this.dataArray[n]%2 === 0){
// this.currentData = this.dataArray[n]
// }
// }
// })
// }
// map(){
// setInterval(()=>{
// console.log(`map ${this.currentData} to ${this.currentData* 5}`)
// })
// return this.currentData* 5
// }
// forEach(){
// console.log(`消费def2`,this.currentData)
// }
// delay(){
// setInterval(()=>{this.forEach()},1000)
// }
// }
// const def1 = new arrayFun([0,1,2,3,4,5,6,7,8,9,10])
// const def2 = def1.filter().map()
// def2.delay()
//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
// const urls =[
// 'https://www.kkkkk1000.com/image/getImgData/getImgDatadata.jpg',
// 'https://www.kkkkk1000.com/image/getImgData/gray.gif',
// 'https://www.kkkkk1000.com/image/getImgData/Reacticle.gif',
// 'https://www.kkkkk1000.com/image/getImgData/arithmotic.png',
// 'https://www.kkkkk1000.com/image/getImgData/arithmotic2.gif',
// 'https://www.kkkkk1000.com/image/getImgData/getImgDataErroe.jpg',
// ]
// function loadImages(urls=[]){
// Promise.race(requestImg(urls)).then(function(resoule){console.log(resoule)})
// }
// function requestImg(urls){
// let promises = []
// for(let i = 0;i<urls.length;i++){
// promises.push(new Promise(function (resolve,reject){
// var img= new Image()
// img.onload = function(){
// resolve(img)
// }
// img.src = urls[i]
// }))
// }
// }
// loadImages(urls)
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<div id="app" @click="init" >
{{message}}
<input v-model="message"/>
<div>
<span v-for="item in groceryList">{{item.text}}</span>
</div>
</div>
<script>
var app = new Vue({
el:'#app',
data:{
message:'123',
groceryList: [
{ id: 0, text: '蔬菜' },
{ id: 1, text: '奶酪' },
{ id: 2, text: '随便其它什么人吃的东西' }
]
},
computed:function(){//计算属性
},
methods:{
init:function(){
this.message = this.message.split('').reverse().join('')
}
},
created:function(){
},
mounted:function(){
this.message = this.message.split('').reverse().join('')
},
updated:function (){
},
destroyed:function(){
}
})
</script>