草庐IT

微信小程序生成条形码

NOyesNONO_ 2023-04-26 原文

以下是处理过 wx.createCanvasContext()的,可以直接用

1. utils下新增barCode.js

var CHAR_TILDE = 126;
var CODE_FNC1 = 102;

var SET_STARTA = 103;
var SET_STARTB = 104;
var SET_STARTC = 105;
var SET_SHIFT = 98;
var SET_CODEA = 101;
var SET_CODEB = 100;
var SET_STOP = 106;


var REPLACE_CODES = {
  CHAR_TILDE: CODE_FNC1 //~ corresponds to FNC1 in GS1-128 standard
}

var CODESET = {
  ANY: 1,
  AB: 2,
  A: 3,
  B: 4,
  C: 5
};

function getBytes(str) {
  var bytes = [];
  for (var i = 0; i < str.length; i++) {
    bytes.push(str.charCodeAt(i));
  }
  return bytes;
}

exports.code128 = function (ctx, text, width, height) {

  width = parseInt(width);

  height = parseInt(height);

  var codes = stringToCode128(text);

  var g = new Graphics(ctx, width, height);

  var barWeight = g.area.width / ((codes.length - 3) * 11 + 35);

  var x = g.area.left;
  var y = g.area.top;
  for (var i = 0; i < codes.length; i++) {
    var c = codes[i];
    //two bars at a time: 1 black and 1 white
    for (var bar = 0; bar < 8; bar += 2) {
      var barW = PATTERNS[c][bar] * barWeight;
      // var barH = height - y - this.border;
      var barH = height - y;
      var spcW = PATTERNS[c][bar + 1] * barWeight;

      //no need to draw if 0 width
      if (barW > 0) {
        g.fillFgRect(x, y, barW, barH);
      }

      x += barW + spcW;
    }
  }

  // ctx.draw();---------------------------------------------
}


function stringToCode128(text) {

  var barc = {
    currcs: CODESET.C
  };

  var bytes = getBytes(text);
  //decide starting codeset
  var index = bytes[0] == CHAR_TILDE ? 1 : 0;

  var csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
  var csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
  barc.currcs = getBestStartSet(csa1, csa2);
  barc.currcs = perhapsCodeC(bytes, barc.currcs);

  //if no codeset changes this will end up with bytes.length+3
  //start, checksum and stop
  var codes = new Array();

  switch (barc.currcs) {
    case CODESET.A:
      codes.push(SET_STARTA);
      break;
    case CODESET.B:
      codes.push(SET_STARTB);
      break;
    default:
      codes.push(SET_STARTC);
      break;
  }


  for (var i = 0; i < bytes.length; i++) {
    var b1 = bytes[i]; //get the first of a pair
    //should we translate/replace
    if (b1 in REPLACE_CODES) {
      codes.push(REPLACE_CODES[b1]);
      i++ //jump to next
      b1 = bytes[i];
    }

    //get the next in the pair if possible
    var b2 = bytes.length > (i + 1) ? bytes[i + 1] : -1;

    codes = codes.concat(codesForChar(b1, b2, barc.currcs));
    //code C takes 2 chars each time
    if (barc.currcs == CODESET.C) i++;
  }

  //calculate checksum according to Code 128 standards
  var checksum = codes[0];
  for (var weight = 1; weight < codes.length; weight++) {
    checksum += (weight * codes[weight]);
  }
  codes.push(checksum % 103);

  codes.push(SET_STOP);

  //encoding should now be complete
  return codes;

  function getBestStartSet(csa1, csa2) {
    //tries to figure out the best codeset
    //to start with to get the most compact code
    var vote = 0;
    vote += csa1 == CODESET.A ? 1 : 0;
    vote += csa1 == CODESET.B ? -1 : 0;
    vote += csa2 == CODESET.A ? 1 : 0;
    vote += csa2 == CODESET.B ? -1 : 0;
    //tie goes to B due to my own predudices
    return vote > 0 ? CODESET.A : CODESET.B;
  }

  function perhapsCodeC(bytes, codeset) {
    for (var i = 0; i < bytes.length; i++) {
      var b = bytes[i]
      if ((b < 48 || b > 57) && b != CHAR_TILDE)
        return codeset;
    }
    return CODESET.C;
  }

  //chr1 is current byte
  //chr2 is the next byte to process. looks ahead.
  function codesForChar(chr1, chr2, currcs) {
    var result = [];
    var shifter = -1;

    if (charCompatible(chr1, currcs)) {
      if (currcs == CODESET.C) {
        if (chr2 == -1) {
          shifter = SET_CODEB;
          currcs = CODESET.B;
        }
        else if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
          //need to check ahead as well
          if (charCompatible(chr2, CODESET.A)) {
            shifter = SET_CODEA;
            currcs = CODESET.A;
          }
          else {
            shifter = SET_CODEB;
            currcs = CODESET.B;
          }
        }
      }
    }
    else {
      //if there is a next char AND that next char is also not compatible
      if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
        //need to switch code sets
        switch (currcs) {
          case CODESET.A:
            shifter = SET_CODEB;
            currcs = CODESET.B;
            break;
          case CODESET.B:
            shifter = SET_CODEA;
            currcs = CODESET.A;
            break;
        }
      }
      else {
        //no need to shift code sets, a temporary SHIFT will suffice
        shifter = SET_SHIFT;
      }
    }

    //ok some type of shift is nessecary
    if (shifter != -1) {
      result.push(shifter);
      // result.push(codeValue(chr2));-----------------------------------
      result.push(codeValue(chr1));
    }
    else {
      if (currcs == CODESET.C) {
        //include next as well
        result.push(codeValue(chr1, chr2));
      }
      else {
        result.push(codeValue(chr1));
      }
    }
    barc.currcs = currcs;

    return result;
  }
}

//reduce the ascii code to fit into the Code128 char table
function codeValue(chr1, chr2) {
  if (typeof chr2 == "undefined") {
    return chr1 >= 32 ? chr1 - 32 : chr1 + 64;
  }
  else {
    return parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2));
  }
}

function charCompatible(chr, codeset) {
  var csa = codeSetAllowedFor(chr);
  if (csa == CODESET.ANY) return true;
  //if we need to change from current
  if (csa == CODESET.AB) return true;
  if (csa == CODESET.A && codeset == CODESET.A) return true;
  if (csa == CODESET.B && codeset == CODESET.B) return true;
  return false;
}

function codeSetAllowedFor(chr) {
  if (chr >= 48 && chr <= 57) {
    //0-9
    return CODESET.ANY;
  }
  else if (chr >= 32 && chr <= 95) {
    //0-9 A-Z
    return CODESET.AB;
  }
  else {
    //if non printable
    return chr < 32 ? CODESET.A : CODESET.B;
  }
}

var Graphics = function (ctx, width, height) {

  this.width = width;
  this.height = height;
  this.quiet = Math.round(this.width / 40);

  this.border_size = 0;
  this.padding_width = 0;

  this.area = {
    width: width - this.padding_width * 2 - this.quiet * 2,
    height: height - this.border_size * 2,
    top: this.border_size - 4,
    left: this.padding_width + this.quiet
  };

  this.ctx = ctx;
  this.fg = "#000000";
  this.bg = "#ffffff";

  // fill background
  this.fillBgRect(0, 0, width, height);

  // fill center to create border
  this.fillBgRect(0, this.border_size, width, height - this.border_size * 2);
}

//use native color
Graphics.prototype._fillRect = function (x, y, width, height, color) {
  // this.ctx.setFillStyle(color)---------------------------------
  this.ctx.fillStyle  = color
  this.ctx.fillRect(x, y, width, height)
}

Graphics.prototype.fillFgRect = function (x, y, width, height) {
  this._fillRect(x, y, width, height, this.fg);
}

Graphics.prototype.fillBgRect = function (x, y, width, height) {
  this._fillRect(x, y, width, height, this.bg);
}

var PATTERNS = [
  [2, 1, 2, 2, 2, 2, 0, 0],  // 0
  [2, 2, 2, 1, 2, 2, 0, 0],  // 1
  [2, 2, 2, 2, 2, 1, 0, 0],  // 2
  [1, 2, 1, 2, 2, 3, 0, 0],  // 3
  [1, 2, 1, 3, 2, 2, 0, 0],  // 4
  [1, 3, 1, 2, 2, 2, 0, 0],  // 5
  [1, 2, 2, 2, 1, 3, 0, 0],  // 6
  [1, 2, 2, 3, 1, 2, 0, 0],  // 7
  [1, 3, 2, 2, 1, 2, 0, 0],  // 8
  [2, 2, 1, 2, 1, 3, 0, 0],  // 9
  [2, 2, 1, 3, 1, 2, 0, 0],  // 10
  [2, 3, 1, 2, 1, 2, 0, 0],  // 11
  [1, 1, 2, 2, 3, 2, 0, 0],  // 12
  [1, 2, 2, 1, 3, 2, 0, 0],  // 13
  [1, 2, 2, 2, 3, 1, 0, 0],  // 14
  [1, 1, 3, 2, 2, 2, 0, 0],  // 15
  [1, 2, 3, 1, 2, 2, 0, 0],  // 16
  [1, 2, 3, 2, 2, 1, 0, 0],  // 17
  [2, 2, 3, 2, 1, 1, 0, 0],  // 18
  [2, 2, 1, 1, 3, 2, 0, 0],  // 19
  [2, 2, 1, 2, 3, 1, 0, 0],  // 20
  [2, 1, 3, 2, 1, 2, 0, 0],  // 21
  [2, 2, 3, 1, 1, 2, 0, 0],  // 22
  [3, 1, 2, 1, 3, 1, 0, 0],  // 23
  [3, 1, 1, 2, 2, 2, 0, 0],  // 24
  [3, 2, 1, 1, 2, 2, 0, 0],  // 25
  [3, 2, 1, 2, 2, 1, 0, 0],  // 26
  [3, 1, 2, 2, 1, 2, 0, 0],  // 27
  [3, 2, 2, 1, 1, 2, 0, 0],  // 28
  [3, 2, 2, 2, 1, 1, 0, 0],  // 29
  [2, 1, 2, 1, 2, 3, 0, 0],  // 30
  [2, 1, 2, 3, 2, 1, 0, 0],  // 31
  [2, 3, 2, 1, 2, 1, 0, 0],  // 32
  [1, 1, 1, 3, 2, 3, 0, 0],  // 33
  [1, 3, 1, 1, 2, 3, 0, 0],  // 34
  [1, 3, 1, 3, 2, 1, 0, 0],  // 35
  [1, 1, 2, 3, 1, 3, 0, 0],  // 36
  [1, 3, 2, 1, 1, 3, 0, 0],  // 37
  [1, 3, 2, 3, 1, 1, 0, 0],  // 38
  [2, 1, 1, 3, 1, 3, 0, 0],  // 39
  [2, 3, 1, 1, 1, 3, 0, 0],  // 40
  [2, 3, 1, 3, 1, 1, 0, 0],  // 41
  [1, 1, 2, 1, 3, 3, 0, 0],  // 42
  [1, 1, 2, 3, 3, 1, 0, 0],  // 43
  [1, 3, 2, 1, 3, 1, 0, 0],  // 44
  [1, 1, 3, 1, 2, 3, 0, 0],  // 45
  [1, 1, 3, 3, 2, 1, 0, 0],  // 46
  [1, 3, 3, 1, 2, 1, 0, 0],  // 47
  [3, 1, 3, 1, 2, 1, 0, 0],  // 48
  [2, 1, 1, 3, 3, 1, 0, 0],  // 49
  [2, 3, 1, 1, 3, 1, 0, 0],  // 50
  [2, 1, 3, 1, 1, 3, 0, 0],  // 51
  [2, 1, 3, 3, 1, 1, 0, 0],  // 52
  [2, 1, 3, 1, 3, 1, 0, 0],  // 53
  [3, 1, 1, 1, 2, 3, 0, 0],  // 54
  [3, 1, 1, 3, 2, 1, 0, 0],  // 55
  [3, 3, 1, 1, 2, 1, 0, 0],  // 56
  [3, 1, 2, 1, 1, 3, 0, 0],  // 57
  [3, 1, 2, 3, 1, 1, 0, 0],  // 58
  [3, 3, 2, 1, 1, 1, 0, 0],  // 59
  [3, 1, 4, 1, 1, 1, 0, 0],  // 60
  [2, 2, 1, 4, 1, 1, 0, 0],  // 61
  [4, 3, 1, 1, 1, 1, 0, 0],  // 62
  [1, 1, 1, 2, 2, 4, 0, 0],  // 63
  [1, 1, 1, 4, 2, 2, 0, 0],  // 64
  [1, 2, 1, 1, 2, 4, 0, 0],  // 65
  [1, 2, 1, 4, 2, 1, 0, 0],  // 66
  [1, 4, 1, 1, 2, 2, 0, 0],  // 67
  [1, 4, 1, 2, 2, 1, 0, 0],  // 68
  [1, 1, 2, 2, 1, 4, 0, 0],  // 69
  [1, 1, 2, 4, 1, 2, 0, 0],  // 70
  [1, 2, 2, 1, 1, 4, 0, 0],  // 71
  [1, 2, 2, 4, 1, 1, 0, 0],  // 72
  [1, 4, 2, 1, 1, 2, 0, 0],  // 73
  [1, 4, 2, 2, 1, 1, 0, 0],  // 74
  [2, 4, 1, 2, 1, 1, 0, 0],  // 75
  [2, 2, 1, 1, 1, 4, 0, 0],  // 76
  [4, 1, 3, 1, 1, 1, 0, 0],  // 77
  [2, 4, 1, 1, 1, 2, 0, 0],  // 78
  [1, 3, 4, 1, 1, 1, 0, 0],  // 79
  [1, 1, 1, 2, 4, 2, 0, 0],  // 80
  [1, 2, 1, 1, 4, 2, 0, 0],  // 81
  [1, 2, 1, 2, 4, 1, 0, 0],  // 82
  [1, 1, 4, 2, 1, 2, 0, 0],  // 83
  [1, 2, 4, 1, 1, 2, 0, 0],  // 84
  [1, 2, 4, 2, 1, 1, 0, 0],  // 85
  [4, 1, 1, 2, 1, 2, 0, 0],  // 86
  [4, 2, 1, 1, 1, 2, 0, 0],  // 87
  [4, 2, 1, 2, 1, 1, 0, 0],  // 88
  [2, 1, 2, 1, 4, 1, 0, 0],  // 89
  [2, 1, 4, 1, 2, 1, 0, 0],  // 90
  [4, 1, 2, 1, 2, 1, 0, 0],  // 91
  [1, 1, 1, 1, 4, 3, 0, 0],  // 92
  [1, 1, 1, 3, 4, 1, 0, 0],  // 93
  [1, 3, 1, 1, 4, 1, 0, 0],  // 94
  [1, 1, 4, 1, 1, 3, 0, 0],  // 95
  [1, 1, 4, 3, 1, 1, 0, 0],  // 96
  [4, 1, 1, 1, 1, 3, 0, 0],  // 97
  [4, 1, 1, 3, 1, 1, 0, 0],  // 98
  [1, 1, 3, 1, 4, 1, 0, 0],  // 99
  [1, 1, 4, 1, 3, 1, 0, 0],  // 100
  [3, 1, 1, 1, 4, 1, 0, 0],  // 101
  [4, 1, 1, 1, 3, 1, 0, 0],  // 102
  [2, 1, 1, 4, 1, 2, 0, 0],  // 103
  [2, 1, 1, 2, 1, 4, 0, 0],  // 104
  [2, 1, 1, 2, 3, 2, 0, 0],  // 105
  [2, 3, 3, 1, 1, 1, 2, 0]   // 106
]

2. utils下新增codeIndex.js文件

var barcode = require('./barCode');

function convert_length(length) {
    return Math.round(wx.getSystemInfoSync().windowWidth * length / 750);
}

function barc(context, code, width, height) {
  barcode.code128(context, code, convert_length(width), convert_length(height))
}

function qrc(id, code, width, height) {
    qrcode.api.draw(code, {
        ctx: wx.createCanvasContext(id),
        width: convert_length(width),
        height: convert_length(height)
    })
}

module.exports = {
    barcode: barc,
    qrcode: qrc
}

3.业务wxml里新增元素

<canvas type="2d" id="barcode"></canvas>

4. 业务js里新增方法

  // 创建条形码
  createBarcode: function () {
    const query = wx.createSelectorQuery()
    query.select('#barcode')
      .fields({
        node: true,
        size: true
      })
      .exec((res) => {
        const canvas = res[0].node
        if (!canvas) return
        /* 获取 canvas 实例 */
        const context = canvas.getContext('2d')
        const dpr = wx.getSystemInfoSync().pixelRatio
        canvas.width = res[0].width * dpr
        canvas.height = res[0].height * dpr
        context.scale(dpr, dpr)
        barCode.barcode(context, '123456', 440, 180)
      })
  },

5. 业务样式

#barcode{
    display: block;
    width: 600rpx;
    height: 140rpx;
    margin: 0 auto;
    position: relative;
    z-index: 1;
 }

5. 提示:上述1/2的源码是经过处理的,直接用就可以了

这里标注一下都做了什么处理:原来源码是用的 wx.createCanvasContext(id),这个方法已经被废弃了。处理后改成了 wx.createSelectorQuery()方法,相应的,源码中的其他部分也要发生变化。

1. codeIndex.js

原来的:

function barc(id, code, width, height) {
    barcode.code128(wx.createCanvasContext(id), code, convert_length(width), convert_length(height))
}

改为:

function barc(ctx, code, width, height) {
    barcode.code128(ctx, code, convert_length(width), convert_length(height))
}

2.barCode.js

原来的

Graphics.prototype._fillRect = function(x, y, width, height, color) {
    this.ctx.setFillStyle(color)
    this.ctx.fillRect(x, y, width, height)
}

改为:

Graphics.prototype._fillRect = function(x, y, width, height, color) {
    this.ctx.fillStyle  = color;
    this.ctx.fillRect(x, y, width, height)
}

3.barCode.js

注掉 ctx.draw()

4.barCode.js

搜索result.push(codeValue(chr2))chr2改为chr1

 if (shifter != -1) {
     result.push(shifter);
     result.push(codeValue(chr1));
 }

源码: https://www.jianshu.com/p/3abec53a0bb2
处理方法原帖:https://developers.weixin.qq.com/community/develop/article/doc/0006cae8024368f5240fc99b15b813

有关微信小程序生成条形码的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  3. ruby - 如何使用 Ruby aws/s3 Gem 生成安全 URL 以从 s3 下载文件 - 2

    我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A

  4. ruby-on-rails - Ruby on Rails - 为文本区域和图片生成列 - 2

    我是Rails的新手,所以请原谅简单的问题。我正在为一家公司创建一个网站。那家公司想在网站上展示它的客户。我想让客户自己管理这个。我正在为“客户”生成一个表格,我想要的三列是:公司名称、公司描述和Logo。对于名称,我使用的是name:string但不确定如何在脚本/生成脚手架终端命令中最好地创建描述列(因为我打算将其设置为文本区域)和图片。我怀疑描述(我想成为一个文本区域)应该仍然是描述:字符串,然后以实际形式进行调整。不确定如何处理图片字段。那么……说来话长:我在脚手架命令中输入什么来生成描述和图片列? 最佳答案 对于“文本”数

  5. ruby-on-rails - 如何生成传递一些自定义参数的 `link_to` URL? - 2

    我正在使用RubyonRails3.0.9,我想生成一个传递一些自定义参数的link_toURL。也就是说,有一个articles_path(www.my_web_site_name.com/articles)我想生成如下内容:link_to'Samplelinktitle',...#HereIshouldimplementthecode#=>'http://www.my_web_site_name.com/articles?param1=value1¶m2=value2&...我如何编写link_to语句“alàRubyonRailsWay”以实现该目的?如果我想通过传递一些

  6. ruby-on-rails - 如何在 Rails 3 中创建自定义脚手架生成器? - 2

    有这些railscast。http://railscasts.com/episodes/218-making-generators-in-rails-3有了这个,你就会知道如何创建样式表和脚手架生成器。http://railscasts.com/episodes/216-generators-in-rails-3通过这个,您可以了解如何添加一些文件来修改脚手架View。我想把两者结合起来。我想创建一个生成器,它也可以创建脚手架View。有点像RyanBates漂亮的生成器或web_app_themegem(https://github.com/pilu/web-app-theme)。我

  7. 报告回顾丨模型进化狂飙,DetectGPT能否识别最新模型生成结果? - 2

    导读语言模型给我们的生产生活带来了极大便利,但同时不少人也利用他们从事作弊工作。如何规避这些难辨真伪的文字所产生的负面影响也成为一大难题。在3月9日智源Live第33期活动「DetectGPT:判断文本是否为机器生成的工具」中,主讲人Eric为我们讲解了DetectGPT工作背后的思路——一种基于概率曲率检测的用于检测模型生成文本的工具,它可以帮助我们更好地分辨文章的来源和可信度,对保护信息真实、防止欺诈等方面具有重要意义。本次报告主要围绕其功能,实现和效果等展开。(文末点击“阅读原文”,查看活动回放。)Ericmitchell斯坦福大学计算机系四年级博士生,由ChelseaFinn和Chri

  8. 微信小程序通过字典表匹配对应数据 - 2

    前言一般来说,前端根据后台返回code码展示对应内容只需要在前台判断code值展示对应的内容即可,但要是匹配的code码比较多或者多个页面用到时,为了便于后期维护,后台就会使用字典表让前端匹配,下面我将在微信小程序中通过wxs的方法实现这个操作。为什么要使用wxs?{{method(a,b)}}可以看到,上述代码是一个调用方法传值的操作,在vue中很常见,多用于数据之间的转换,但由于微信小程序诸多限制的原因,你并不能优雅的这样操作,可能有人会说,为什么不用if判断实现呢?但是if判断的局限性在于如果存在数据量过大时,大量重复性操作和if判断会让你的代码显得异常冗余。wxswxs相当于是一个独立

  9. 计算机毕业设计ssm+vue基本微信小程序的小学生兴趣延时班预约小程序 - 2

    项目介绍随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱小学生兴趣延时班预约小程序的设计与开发被用户普遍使用,为方便用户能够可以随时进行小学生兴趣延时班预约小程序的设计与开发的数据信息管理,特开发了小程序的设计与开发的管理系统。小学生兴趣延时班预约小程序的设计与开发的开发利用现有的成熟技术参考,以源代码为模板,分析功能调整与小学生兴趣延时班预约小程序的设计与开发的实际需求相结合,讨论了小学生兴趣延时班预约小程序的设计与开发的使用。开发环境开发说明:前端使用微信微信小程序开发工具:后端使用ssm:VU

  10. 微信小程序开发入门与实战(Behaviors使用) - 2

    @作者:SYFStrive @博客首页:HomePage📜:微信小程序📌:个人社区(欢迎大佬们加入)👉:社区链接🔗📌:觉得文章不错可以点点关注👉:专栏连接🔗💃:感谢支持,学累了可以先看小段由小胖给大家带来的街舞👉微信小程序(🔥)目录自定义组件-behaviors    1、什么是behaviors    2、behaviors的工作方式    3、创建behavior    4、导入并使用behavior    5、behavior中所有可用的节点    6、同名字段的覆盖和组合规则总结最后自定义组件-behaviors    1、什么是behaviorsbehaviors是小程序中,用于实现

随机推荐