1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- function previewImg(url,list,rangKey){
-
- if(!url){
- uni.$tm.toast("参数有误");
- return;
- }
-
- if(arguments.length==1){
- uni.previewImage({
- current:url,
- urls:list?list:[url]
- })
- }else if(arguments.length===3){
-
- if(typeof list[0] === 'object' && typeof list[0] !== 'undefined'){
-
- let urls = [];
- list.forEach(item=>{
- urls.push(item[rangKey]);
- })
-
- uni.previewImage({
- current:url,
- urls:urls,
- fail: (er) => {
- console.warn(er)
- }
- })
- }else if(typeof list[0] === 'string'){
- uni.previewImage({
- current:url,
- urls:list
- })
- }
- }else{
- uni.$tm.toast("参数有误");
- }
-
-
-
- }
- export default previewImg
|