美文网首页
2019-02-18

2019-02-18

作者: 否冷_ | 来源:发表于2019-02-18 12:44 被阅读0次


                                                     小程序wxs的应用

        一,什么是wxs,

                WXS(WeiXin Script)是小程序的一套脚本语言,结合 WXML,可以构建出页面的结构。

        二 ,wxs的应用

                 创建 index .wxs文件       

                   var getImageSrc = function (imageKey) {

                             if (imageKey != null) { 

                                 return 'https://assets.xxxx.com/' + imageKey

                             } else { 

                                 return imageKey 

                             } 

                       } 

                  module.exports = { getImageSrc: getImageSrc } 

            在wxml页面引入

             <wxs src="../wxs/index.wxs" module="util" />        

             <image src="{{ util.getImageSrc(item.imagesrsrc) }}" />          

                        

相关文章

网友评论

      本文标题:2019-02-18

      本文链接:https://www.haomeiwen.com/subject/wpcaeqtx.html