pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

        <tfoot id='ZfGSt'></tfoot>
      1. <small id='ZfGSt'></small><noframes id='ZfGSt'>

      2. <i id='ZfGSt'><tr id='ZfGSt'><dt id='ZfGSt'><q id='ZfGSt'><span id='ZfGSt'><b id='ZfGSt'><form id='ZfGSt'><ins id='ZfGSt'></ins><ul id='ZfGSt'></ul><sub id='ZfGSt'></sub></form><legend id='ZfGSt'></legend><bdo id='ZfGSt'><pre id='ZfGSt'><center id='ZfGSt'></center></pre></bdo></b><th id='ZfGSt'></th></span></q></dt></tr></i><div class="pfjn57l" id='ZfGSt'><tfoot id='ZfGSt'></tfoot><dl id='ZfGSt'><fieldset id='ZfGSt'></fieldset></dl></div>

          <bdo id='ZfGSt'></bdo><ul id='ZfGSt'></ul>
        <legend id='ZfGSt'><style id='ZfGSt'><dir id='ZfGSt'><q id='ZfGSt'></q></dir></style></legend>

      3. Angular 6 - 如何在組件級別應用外部 CSS 樣式表(傳

        Angular 6 - How to apply external css stylesheet (leaflet) at component level?(Angular 6 - 如何在組件級別應用外部 CSS 樣式表(傳單)?)
      4. <i id='UiUle'><tr id='UiUle'><dt id='UiUle'><q id='UiUle'><span id='UiUle'><b id='UiUle'><form id='UiUle'><ins id='UiUle'></ins><ul id='UiUle'></ul><sub id='UiUle'></sub></form><legend id='UiUle'></legend><bdo id='UiUle'><pre id='UiUle'><center id='UiUle'></center></pre></bdo></b><th id='UiUle'></th></span></q></dt></tr></i><div class="rdpb5dn" id='UiUle'><tfoot id='UiUle'></tfoot><dl id='UiUle'><fieldset id='UiUle'></fieldset></dl></div>
          <tfoot id='UiUle'></tfoot>
            <bdo id='UiUle'></bdo><ul id='UiUle'></ul>
          • <legend id='UiUle'><style id='UiUle'><dir id='UiUle'><q id='UiUle'></q></dir></style></legend>

                <tbody id='UiUle'></tbody>

                <small id='UiUle'></small><noframes id='UiUle'>

                  本文介紹了Angular 6 - 如何在組件級別應用外部 CSS 樣式表(傳單)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  嘗試在 Angular 6 組件中使用 Leaflet.根據 css 文件的鏈接方式,地圖顯示正常或混亂,丟失的圖塊順序不正確,這意味著 css 未被考慮在內.

                  Trying to use Leaflet in an Angular 6 component. Depending on how the css file is linked, the map shows ok or is messed up, there are missing tiles not in the right order, which means the css is not taken into account.

                  我設法使它與將 css 鏈接到應用程序級別(全局)的 2 個解決方案一起工作,但絕不只鏈接到組件.這是我嘗試過的(除了閱讀了幾篇關于 css/leaflet/Angular 的帖子):

                  I managed to make it work with 2 solutions linking the css to the application level (global), but never only to the component. Here's what I tried (in addition to reading several posts about css/leaflet/Angular):

                  工作過 - 全球層面:

                  // styles.css
                  @import url("assets/lib/leaflet/leaflet.css");
                  

                  工作過 - 全球層面:

                  // index.html
                  <link rel="stylesheet" href="./assets/lib/leaflet/leaflet.css" type="text/css">
                  

                  無效 - 全局級別:

                  // angular.json
                  "styles": [
                      "src/styles.css",
                      "src/assets/lib/leaflet/leaflet.css"
                  ],
                  

                  不起作用 - 組件級別:

                  // ...
                  
                  import * as L from "../assets/lib/leaflet/leaflet.js";
                  import "../assets/lib/leaflet/leaflet-bing-layer.js";
                  import { BingHelper } from "../assets/lib/bing/bing-helper.js";
                  
                  // -> importing the .css file here does not work
                  
                  @Component({
                      templateUrl: "./map.component.html",
                      selector: "app-map",
                      styleUrls: ["../assets/lib/leaflet/leaflet.css"] // -> does not work
                  
                      // -> also tried to put the content of the .css in style: "", did not work neither
                  
                  })
                  export class MapComponent implements AfterViewInit {
                      ngAfterViewInit() {
                          var map = L.map("map", {
                              attributionControl: false,
                              zoom: 8,
                              minZoom: 3,
                              maxZoom: 15,
                              center: new L.LatLng(40.737, -73.923)
                          });
                          // ...
                  

                  不起作用:封裝 - 組件級別:將外部css樣式加載到Angular 2組件中

                  Did not work: encapsulation - component level: Load external css style into Angular 2 Component

                  從 CDN 加載而不是本地文件不會改變問題.

                  Loading from CDN instead of local file does not change the issue.

                  注意:我正在使用 Bing 層擴展,但這對此問題沒有影響.我也有同樣的問題,而是使用 Mapbox 瓦片.

                  問題:有沒有辦法將 Leaflet css 鏈接到組件中,并使其僅可用于該組件,而不能用于整個 Angular 應用程序?

                  Question: is there a way to link Leaflet css in a component and make it only available to the component, but not to the whole Angular application?

                  謝謝!

                  推薦答案

                  好的,這就是有效的方法(感謝@Palsri,我再次閱讀了博客文章和 Angular 樣式指南,并嘗試了以下方法,效果很好):

                  Ok, here's what worked (thanks @Palsri, I read once more the blog post and the Angular styling guidelines and tried the following, which worked):

                  在單獨的 css 文件中,導入傳單 css:

                  In a separate css file, import the leaflet css:

                  // map.component.css
                  @import url("../assets/lib/leaflet/leaflet.css");
                  
                  .mapstyle {
                      width: 100%;
                      height:100%;
                  };
                  

                  然后在組件中,引用這個css而不是leaflet css,如下:

                  Then in the component, reference this css instead of the leaflet css as follows:

                  @Component({
                      templateUrl: "./map.component.html",
                      selector: "app-map",
                      styleUrls: ["./map.component.css"],
                      encapsulation: ViewEncapsulation.None
                  })
                  

                  這是html模板中的代碼:

                  Here's the code in the html template:

                  <div id="map" class="mapstyle"></div>
                  

                  還有一件事:要使高度 % 起作用,您需要定義父母的大小,我目前在 index.html 中這樣做如下:

                  One more thing: for the height % to work, you need to define the parents size, which I currently did in the index.html as follows:

                  <style>
                  html, body {
                      min-height: 100% !important;
                      height:     100%;
                      padding: 0px 0px 0px 0px;
                      margin:  0px 0px 0px 0px;
                  }
                  </style>
                  

                  希望這會有所幫助.

                  這篇關于Angular 6 - 如何在組件級別應用外部 CSS 樣式表(傳單)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  <i id='hNNal'><tr id='hNNal'><dt id='hNNal'><q id='hNNal'><span id='hNNal'><b id='hNNal'><form id='hNNal'><ins id='hNNal'></ins><ul id='hNNal'></ul><sub id='hNNal'></sub></form><legend id='hNNal'></legend><bdo id='hNNal'><pre id='hNNal'><center id='hNNal'></center></pre></bdo></b><th id='hNNal'></th></span></q></dt></tr></i><div class="jtnbfzl" id='hNNal'><tfoot id='hNNal'></tfoot><dl id='hNNal'><fieldset id='hNNal'></fieldset></dl></div>

                  <small id='hNNal'></small><noframes id='hNNal'>

                          <tfoot id='hNNal'></tfoot>
                            <tbody id='hNNal'></tbody>

                          <legend id='hNNal'><style id='hNNal'><dir id='hNNal'><q id='hNNal'></q></dir></style></legend>
                          • <bdo id='hNNal'></bdo><ul id='hNNal'></ul>
                            主站蜘蛛池模板: 超声波流量计_流量标准装置生产厂家 _河南盛天精密测控 | elisa试剂盒价格-酶联免疫试剂盒-猪elisa试剂盒-上海恒远生物科技有限公司 | CTAB,表面活性剂1631溴型(十六烷基三甲基溴化铵)-上海升纬化工原料有限公司 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | nalgene洗瓶,nalgene量筒,nalgene窄口瓶,nalgene放水口大瓶,浙江省nalgene代理-杭州雷琪实验器材有限公司 | 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 深圳货架厂_仓库货架公司_重型仓储货架_线棒货架批发-深圳市诺普泰仓储设备有限公司 | 论文查重_免费论文查重_知网学术不端论文查重检测系统入口_论文查重软件 | 广州番禺搬家公司_天河黄埔搬家公司_企业工厂搬迁_日式搬家_广州搬家公司_厚道搬迁搬家公司 | 酒精检测棒,数显温湿度计,酒安酒精测试仪,酒精检测仪,呼气式酒精检测仪-郑州欧诺仪器有限公司 | 英国公司注册-新加坡公司注册-香港公司开户-离岸公司账户-杭州商标注册-杭州优创企业 | 冻干机(冷冻干燥机)_小型|实验型|食品真空冷冻干燥机-松源 | 九爱图纸|机械CAD图纸下载交流中心| 电动葫芦|环链电动葫芦-北京凌鹰名优起重葫芦 | 广东燎了网络科技有限公司官网-网站建设-珠海网络推广-高端营销型外贸网站建设-珠海专业h5建站公司「了了网」 | 扬尘在线监测系统_工地噪声扬尘检测仪_扬尘监测系统_贝塔射线扬尘监测设备「风途物联网科技」 | MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 开锐教育-学历提升-职称评定-职业资格培训-积分入户 | 沈飞防静电地板__机房地板-深圳市沈飞防静电设备有限公司 | 小型气象站_便携式自动气象站_校园气象站-竞道气象设备网 | 石栏杆_青石栏杆_汉白玉栏杆_花岗岩栏杆 - 【石雕之乡】点石石雕石材厂 | HYDAC过滤器,HYDAC滤芯,现货ATOS油泵,ATOS比例阀-东莞市广联自动化科技有限公司 | 蔡司三坐标-影像测量机-3D扫描仪-蔡司显微镜-扫描电镜-工业CT-ZEISS授权代理商三本工业测量 | MOOG伺服阀维修,ATOS比例流量阀维修,伺服阀维修-上海纽顿液压设备有限公司 | 南京租车,南京汽车租赁,南京包车,南京会议租车-南京七熹租车 | 济南ISO9000认证咨询代理公司,ISO9001认证,CMA实验室认证,ISO/TS16949认证,服务体系认证,资产管理体系认证,SC食品生产许可证- 济南创远企业管理咨询有限公司 郑州电线电缆厂家-防火|低压|低烟无卤电缆-河南明星电缆 | 乐之康护 - 专业护工服务平台,提供医院陪护-居家照护-居家康复 | 国际金融网_每日财经新资讯网 | 环氧乙烷灭菌器_压力蒸汽灭菌器_低温等离子过氧化氢灭菌器 _低温蒸汽甲醛灭菌器_清洗工作站_医用干燥柜_灭菌耗材-环氧乙烷灭菌器_脉动真空压力蒸汽灭菌器_低温等离子灭菌设备_河南省三强医疗器械有限责任公司 | 微型驱动系统解决方案-深圳市兆威机电股份有限公司 | 盛源真空泵|空压机-浙江盛源空压机制造有限公司-【盛源官网】 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 临沂招聘网_人才市场_招聘信息_求职招聘找工作请认准【马头商标】 | 水性绝缘漆_凡立水_绝缘漆树脂_环保绝缘漆-深圳维特利环保材料有限公司 | HDPE土工膜,复合土工膜,防渗膜价格,土工膜厂家-山东新路通工程材料有限公司 | 艺术涂料|木纹漆施工|稻草漆厂家|马来漆|石桦奴|水泥漆|选加河南天工涂料 | 环氧树脂地坪_防静电地坪漆_环氧地坪漆涂料厂家-地壹涂料地坪漆 环球电气之家-中国专业电气电子产品行业服务网站! | 环氧树脂地坪漆_济宁市新天地漆业有限公司 | 中央空调维修、中央空调保养、螺杆压缩机维修-苏州东菱空调 | 月嫂_保姆_育婴_催乳_母婴护理_产后康复_养老护理-吉祥到家家政 硫酸亚铁-聚合硫酸铁-除氟除磷剂-复合碳源-污水处理药剂厂家—长隆科技 | 铝合金线槽_铝型材加工_空调挡水板厂家-江阴炜福金属制品有限公司 |