gpt4 book ai didi

dart - 在 dart 中显示纸 toast polymer 元素

转载 作者:行者123 更新时间:2023-12-03 04:05:58 25 4
gpt4 key购买 nike

有谁知道如何从 Dart 中展示一个纸 toast polymer 元素。我能找到的唯一例子有用<paper-button raised onclick="document.querySelector('#toast1').show()">Discard Draft</paper-button>
我试过使用 $['myToast'].show()在我的 Dart 代码中,但它似乎不起作用。我也尝试过使用 querySelector 并调用 show() 但我收到一个警告,表明 show 不是一种方法。如果没有办法从 dart 做到这一点,有没有办法调用 javascript 来显示 dart 中的 toast?

最佳答案

这对我有用...

import 'dart:html';
import 'package:paper_elements/paper_toast.dart';

document.querySelector('#notification').show();

忽略警告……它只是……警告。

我建议您克隆示例项目并查看:
https://github.com/dart-lang/polymer-core-and-paper-examples

关于dart - 在 dart 中显示纸 toast polymer 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28978870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com