美文网首页微信小程序开发程序员
微信小程序开发遇到的坑

微信小程序开发遇到的坑

作者: Lefe | 来源:发表于2017-02-14 21:56 被阅读77次

一:不是‘’,而是``

页面之间进行传值时,我错误的写成了

      wx.navigateTo({
        url: `../input/input?placeholder=${this.data.rowdatas[index]["placeholder"]}&defaultText=${this.data.rowdatas[index]["detail"]}`
      })

这样的写法是错误的需要这样写,url不是使用的单引号:

bindMenu: function(event){
    wx.navigateTo({
        url: `category?name=${event.currentTarget.dataset.name}`
    })
 },

二:创建文件小技巧

你还在一个个文件创建吗?比如我想创建help文件,我需要创建help.js, help.wxml,help.wcss,help.json,这样很麻烦,微信为我们提供一个简单的方法:
直接在app.json文件中添加你想创建的目录就行,他会自动创建help.js, help.wxml,help.wcss,help.json,文件。

  "pages":[
    "pages/me/help"
  ],

三:设置 Text 为一行

设置文本为一行,必须三个一块设置

    text-overflow:ellipsis;
    overflow:hidden;
    white-space: nowrap;

===== 我是有底线的 ======
喜欢我的文章,欢迎关注我的新浪微博 Lefe_x,我会不定期的分享一些开发技巧

相关文章

网友评论

    本文标题:微信小程序开发遇到的坑

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