收藏
回答

v1.02.1808300 WIN工具编译代码报错

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows v1.02.1808300

早上更新了开发工具,之前小程序代码是正常的,新工具上运行就报错,真机预览正常。也不清楚是不是更新了市面机制,更新日志里面没看到




回答关注问题邀请回答
收藏

3 个回答

  • 小程序技术专员-SgLy
    小程序技术专员-SgLy
    2018-08-31

    detail.js 中确定只有一个 Page 构造器吗?换成一个空的页面构造器(Page({}))会报错吗?

    2018-08-31
    有用
    回复 5
    • 金钱豹
      金钱豹
      2018-08-31

      空的同样的报错


      2018-08-31
      回复
    • 小程序技术专员-SgLy
      小程序技术专员-SgLy
      2018-08-31回复金钱豹

      删一下 require 或者 getApp 试试?定位一下问题

      2018-08-31
      回复
    • 金钱豹
      金钱豹
      2018-08-31回复小程序技术专员-SgLy

      这个require 删掉就可以了,但是我其它页面也同样引用这个组件了,就只有这个报错,引用的方式也是一样的,而且工具更新前没有问题,现在新工具上,用真机阅览也没有问题


      2018-08-31
      回复
    • 小程序技术专员-SgLy
      小程序技术专员-SgLy
      2018-08-31回复金钱豹

      require 的时候会同时执行 toast/index.js 中的 Component 构造器,导致报错 do not register multiple pages,你把 function Toast 和 module.exports 换个 js 文件放就可以了

      2018-08-31
      回复
    • 金钱豹
      金钱豹
      2018-08-31回复小程序技术专员-SgLy

      删掉这个require 解决了。谢谢。

      2018-08-31
      回复
  • IVAn
    IVAn
    2018-08-31

    @凌云摘星傲苍穹   问题解决了..   是项目的问题   同事有文件没有提交  然后导致那样...  

    2018-08-31
    有用
    回复 2
    • 小程序技术专员-SgLy
      小程序技术专员-SgLy
      2018-08-31

      你是一样遇到这个问题吗?还是说你是楼主的同事 hhh

      2018-08-31
      回复
    • IVAn
      IVAn
      2018-09-01回复小程序技术专员-SgLy

      .......    没有遇到这个问题  我也不是楼主的同事.....   然后  昨天我那个问题解决了   谢谢

      2018-09-01
      回复
  • 夏洛埃克
    夏洛埃克
    2018-08-31

    你试试删除toast/index.js和toptips/index.js这两个文件 下的page的内容

    2018-08-31
    有用
    回复 2
    • 金钱豹
      金钱豹
      2018-08-31

      这个是组件,没有PAGE内容的

      const FONT_COLOR = '#fff';
      const BG_COLOR = '#e64340';
       
      Component({
        properties: {
          content: String,
          color: {
            type: String,
            value: FONT_COLOR
          },
          backgroundColor: {
            type: String,
            value: BG_COLOR
          },
          isShow: {
            type: Boolean,
            value: false
          },
          duration: {
            type: Number,
            value: 3000
          }
        },
       
        methods: {
          show() {
            const { duration } = this.data;
       
            this._timer && clearTimeout(this._timer);
            this.setData({
              isShow: true
            });
       
            if (duration > 0 && duration !== Infinity) {
              this._timer = setTimeout(() => {
                this.hide();
              }, duration);
            }
          },
       
          hide() {
            this._timer = clearTimeout(this._timer);
       
            this.setData({
              isShow: false
            });
          }
        }
      });
       
      function Toptips(options = {}) {
        const pages = getCurrentPages();
        const ctx = pages[pages.length - 1];
        const defaultOptions = {
          selector: '#zan-toptips',
          duration: 3000
        };
       
        options = Object.assign(defaultOptions, parseParam(options));
       
        const $toptips = ctx.selectComponent(options.selector);
        delete options.selector;
       
        $toptips.setData({
          ...options
        });
        $toptips && $toptips.show();
      }
       
      function parseParam(params) {
        return typeof params === 'object' ? params : { content: params };
      }
       
      module.exports = Toptips;


      2018-08-31
      回复
    • 夏洛埃克
      夏洛埃克
      2018-08-31回复金钱豹

      你试试删除这个Component({})里的内容

      2018-08-31
      回复
登录 后发表内容