0

如果您从此处的链接向下滚动到带有按钮标签“重新打开模态”的示例,它们似乎正在从 javascript 触发模态。我试过Ember.$('.modal).modal('show')没有运气,似乎无法找到一种从js触发它的方法。

我的目标是,在用户提交表单并成功验证后,出现模式。

模板

{{#bs-form model=register onSubmit=(action 'submit') novalidate=true as |form|}}
  {{form.element controlType="text" label="Username" placeholder="Username" property="username"}}
  {{form.element controlType="password" label="Password" placeholder="Password" property="password"}}
  {{bs-button defaultText="Submit" type="outline-success" buttonType="submit"}}
{{/bs-form}}

{{#bs-modal-simple open=modal1 title="Modal" renderInPlace=true}}
    This is a Modal.
{{/bs-modal-simple}}

零件

import Ember from 'ember';

export default Ember.Component.extend({
  actions: {
    submit() {
      Ember.$('.modal').modal('show');
    },
  },
});
4

1 回答 1

2

不,模态将由布尔属性显示。

actions: {
    submit() {
      this.set('modal1', true);
    },
  },
于 2017-03-01T02:11:17.097 回答