xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

true && number !== boolean

true && number !== boolean

bug


  let result = ``;
  // section, name ? create text, compute center point : no need render text
  // feature, labelPoint ??? show text
  // if (type === `section` && name) {
  // if (type === "section" && name) {
  // 🐛 true && number !== boolean
  if (type === "section" && name.length ? true : false) {
    // log(`绑定的选区 properties`, JSON.stringify(feature.properties, null, 4));
    // fillColorReverser(fill);
    // const areaUuid = `area` + uuid.slice(7);
    const ticketArea = {
      id,
      activityEventId,
      ticketCategoryId,
      desc,
      name,
      floor,
      sort,
      status,
    };
    const areaProps = JSON.stringify(ticketArea);
    // areaprops 🐛 areaProps auto convert to lowercase bug / xyzUFO="bug"
    result = `
      <polygon stroke="${stroke || ''}" fill="${fill || polygonFillColor}" points="${points}" center='${center}' areaprops='${areaProps} uuid="${uuid}"></polygon>
      <text x="${x || ''}" y="${y || ''}" fill="${textFillColor}" uuid="${areaUuid}">${name}</text>
    `;
  } else {
    result = `
      <polygon stroke="${stroke || ''}" fill="${fill || polygonFillColor}" points="${points}" center='${center}' uuid="${uuid}"></polygon>
    `;
  }

error

type = "section";
"section"
name = `贵宾区`;
"贵宾区"
type === "section" && name
"贵宾区"
type === "section" & name
0
type === "section" & name.length
1
type === "section" && name.length
3
type === "section"
true
name.length
3

OK

type === "section" && (name.length ? true : false)
// true

type === "section" && name.length > 0
// true


posted @ 2020-03-06 16:19  xgqfrms  阅读(153)  评论(0编辑  收藏  举报