Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

javascript - react-s-alert,警报不会弹出(react-s-alert, alerts won't popup)

So i got a meteor setup with a trello like GUI, based on blaze but with react components and i want to use this library https://www.npmjs.com/package/react-s-alert for showing some popups (feel free to suggest react alternatives).

(所以我得到了一个带有trello的流星雨设置,例如GUI,它基于火焰但具有React组件,我想使用这个库https://www.npmjs.com/package/react-s-alert来显示一些弹出窗口(免费)提出其他建议)。)

So i did this, inside a header bar inside client/components/main/header.js :

(所以我做到了这一点,在client/components/main/header.js的标题栏中:)

import React from 'react';
import Alert from 'react-s-alert';

import 'react-s-alert/dist/s-alert-default.css';
import 'react-s-alert/dist/s-alert-css-effects/slide.css';

...

Template.header.events({
  'click .js-create-board': Popup.open('createBoard'),
  'click .js-alert'() {
      Alert.info('Test message')
    },
});

But when the function is called, nothing happens..

(但是,当调用该函数时,什么也没有发生。)

Anyone can help?

(有人可以帮忙吗?)

  ask by Gobliins translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think you haven't added its initializer component in your main component.

(我认为您尚未在主组件中添加其初始化程序组件。)

Place sAlert component in your main app renderer component also.

(还将sAlert组件放置在您的主应用程序渲染器组件中。)

<Alert stack={{limit: 3}} />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...