首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Aurelia -外部需求

Aurelia -外部需求
EN

Stack Overflow用户
提问于 2015-12-09 18:49:26
回答 1查看 2.2K关注 0票数 2

全新的奥雷利亚,并开始爱上它。但是,我对如何将外部URL包含到视图中感到困惑。例如,

代码语言:javascript
复制
<template>
  <require from="css/bootstrap/bootstrap.css"></require>
  <require from="fonts/font-awesome-4/css/font-awesome.css"></require>
  <require from="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,400italic,700,800"></require>
  <require from="http://fonts.googleapis.com/css?family=Raleway:300,200,100"></require>
  <require from="css/style.css"></require>

  <div class="page-host">
    <router-view></router-view>
  </div>
</template>

我不断地发现错误:

代码语言:javascript
复制
Uncaught SyntaxError: Unexpected token ILLEGAL
Evaluating http://fonts.googleapis.com/css?family=Raleway:300,200,100.js
Error loading http://fonts.googleapis.com/css?family=Raleway:300,200,100.js

我是否对外部CSS或JS文件做了错误的要求?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-09 19:31:36

require标记试图加载一个Aurelia ViewModel,而不仅仅是执行泛型文本导入。

由于Aurelia是一个单一的页面应用程序,所以可以使用传统的index.html方法从您的中加载外部CSS /字体,并且您仍然可以在其他视图上访问它们。

如果你看一下骨架应用程序,他们就是这么做的。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34186701

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档