加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap – Dart聚合物模板中的Twitter Bootstrap样式

发布时间:2020-12-18 00:14:20 所属栏目:安全 来源:网络整理
导读:使用polymer.dart,如何确保使用页面中引用的样式仍可在模板中使用? 我有一个消费或主页面,因此: htmlhead link rel="stylesheet" href="aplaceontheinterweb" / link rel="import" href="ponies.html" //headbody div class="defined_in_the_included_file
使用polymer.dart,如何确保使用页面中引用的样式仍可在模板中使用?

我有一个消费或主页面,因此:

<html>
<head>
    <link rel="stylesheet" href="aplaceontheinterweb" />
    <link rel="import" href="ponies.html" />
</head>
<body>    
    <div class="defined_in_the_included_file">
        ...
    </div>    
    <div is="a-pony"></div>
    <script src="packages/polymer/boot.js"></script>
</body>

</html>

和模板,因此:

<polymer-element name="a-pony" extends="div">
    <template>
        <div class="defined_in_the_css_file_referenced_in_main_html">
            ....
        </div>
    </template>
</polymer-element>

和< div>在呈现页面时,在a-pony元素中没有正确设置样式.

我已经看过演示内容并阅读了this,但这些特定于模板中声明的样式,并不包括样式在外部的情况.

解决方法

尝试在代码中添加apply-author-styles:
import 'package:polymer/polymer.dart';

@CustomTag("a-pony")
class APony extends PolymerElement {
  void created(){
    super.created();
    var root = getShadowRoot("a-pony");
    root.applyAuthorStyles = true;
  }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读