如何在与Aurelia相同的区域中单击按钮时切换页面上的内容区域?

时间:2015-10-16 17:10:43

标签: javascript html aurelia

我需要添加什么,以便当用户点击Current Period按钮时,整个区域(为清晰起见,在第二张图片中为阴影)将替换为{{{{}控制的页面内容1}}和periods.js?我已经尝试periods.html(在下面的第二段代码中显示)并做了其他徒劳的尝试。任何提示将不胜感激。如果需要显示更多代码,请随时告诉我。谢谢!

这是第一张图片: How the page looks

这是第二张图片: Area shaded

click.delegate
System.register([], function (_export) {
  'use strict';

  var History;

  var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

  return {
    setters: [],
    execute: function () {
      History = (function () {
        function History() {
          _classCallCheck(this, History);

          this.heading = 'History';
        };

        return History;
      })();

      _export('History', History);
    }
  };
});

1 个答案:

答案 0 :(得分:0)

click.delegate="..."应该是您的viewmodel的函数。

然后,应该将show.bind="..."添加到正确的元素并在您委派点击的函数内切换该属性。