向createElement添加功能

时间:2019-06-19 22:35:11

标签: javascript reactjs

我研究了反应,现在我尝试解决问题,但是我不知道该怎么做,我将创建一个打开礼物盒的功能,一个使匹配的功能,它们彼此独立地工作,打开盒子时我没有糖果

var cGiftBox = function (_a) {
  var wasOpen = _a.wasOpen,open = _a.open,dispatch = _a.dispatch;
  return React.createElement("div", { className: "floor" },
  React.createElement("div", { className: "box" },
  open ?
  React.createElement("button", { className: "heart-gift", }, "hello") :
  React.createElement(React.Fragment, null),

  React.createElement("div", { className: open ?
    'lid open' :
    wasOpen ?
    'lid close' :
    'lid', onClick: function (e) {return dispatch(toggleBox());} },

  React.createElement("div", { className: "qcube" }, open ? '!' : '?'),
  React.createElement("div", { className: "face ltop" }),
  React.createElement("div", { className: "face lleft" }),
  React.createElement("div", { className: "face lright" })),
  React.createElement("div", { className: "face top" }),
  React.createElement("div", { className: "face left" }),
  React.createElement("div", { className: "face right" })
));
};

// run confetti
function emit() {
  var container = document.getElementById("confetti-container");
  var containerRect = container.getBoundingClientRect();
  var containerData = {
    x: containerRect.left,
    y: containerRect.top,
    height: containerRect.right - containerRect.left,
    width: containerRect.bottom - containerRect.top };

0 个答案:

没有答案