赤壁网站制作,秀洲区住房和城乡建设局网站,网络推广的工作内容是什么,网站模板 div一、多条件判断#xff08;通过函数进行图片展示#xff09; 
效果 代码  
在data中定义图片信息和要传递的数据信息#xff0c;在src中写入函数并携带要传递的数据#xff0c;通过传递的数据在函数中进行判断#xff0c;并返回对应的图片信息 
templateview通过函数进行图片展示 
效果 代码  
在data中定义图片信息和要传递的数据信息在src中写入函数并携带要传递的数据通过传递的数据在函数中进行判断并返回对应的图片信息 
templateviewimage :srcgetImagePath(line1) alt/imageimage :srcgetImagePath(line2) alt/imageimage :srcgetImagePath(line3) alt/image/view
/template
script
export default {data() {return {down: getApp().globalData.icon  index/edit.png,up: getApp().globalData.icon  index/ing.png,line: getApp().globalData.icon  index/none_bind.png,line1:photo1,line2:photo2,line3:photo3,}},methods: {//图片展示getImagePath(rate) {console.log(rate)if (rate  photo1) {return this.line;} else if (rate  photo2) {return this.down;} else {return this.up;}},},onLoad(){},
}
/script
style langscssimage{width:50px;height:50px;}
/style二、三目运算判断一个条件 
效果 代码 三目运算表达式truefalse 
下例当变量info的值为50时执行变量img1反之执行变量img2;当变量info1的值为-50时执行变量img1反之执行变量img2。则这里满足info  50info1  -50则都执行:srcimg1 
templateviewimage :srcinfo 50 ? img1 : img2 alt/imageimage :srcinfo1  -50 ? img1 : img2 alt/image/view
/templatescript
export default {data() {return {info:50,info1:-50,img1: getApp().globalData.icon  index/exit.png,img2: getApp().globalData.icon  index/edit.png,};}
};
/script
styleimage{width:50px;height:50px;}
/style