我想使用toastr来通知用户。我已经按照this指南进行了设置。但是我得到了错误消息:Uncaught TypeError: toastr is not a function。我已经查看了网络选项卡,文件加载正常。已尝试使用cdn进行确认。但没那么走运。这是我尝试使用它的方式:
toastr('Are you the 6 fingered man?');如演示中所示。对我做错了什么有什么建议吗?
发布于 2017-12-19 17:51:56
根据您链接的文档,它应该像这样使用:
toastr.info('Are you the 6 fingered man?')您忘记调用函数info()。
发布于 2017-12-19 17:54:11
您需要使用toastr函数,如下所示。
// Display a warning toast, with no title
toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!')
// Display a success toast, with a title
toastr.success('Have fun storming the castle!', 'Miracle Max Says')
// Display an error toast, with a title
toastr.error('I do not think that word means what you think it means.', 'Inconceivable!')
// Immediately remove current toasts without using animation
toastr.remove()
// Remove current toasts using animation
toastr.clear()
// Override global options
toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})发布于 2017-12-19 17:56:17
请将toastr与info、warning、success、error或option一起使用。
toastr.info('Are you the 6 fingered man?');https://stackoverflow.com/questions/47884114
复制相似问题