将mixin导入到Ember中的加载项导致“未捕获错误:找不到模块”

时间:2016-09-26 07:21:18

标签: javascript ember.js mixins add-on

我在addon/component/my-component.js

中执行以下操作
import Ember from 'ember';
import layout from '../templates/components/my-component';
import myMixin from '../mixins/my-mixin';

export default Ember.Component.extend(myMixin,{
    layout
});

然而,这样做给了我 Uncaught Error: Could not find module foo/mixins/my-mixin imported from foo/components/my-component

my-mixin.js的路径为app/mixins/my-mixin

在给定上述结构的情况下,如何导入我的mixin?谢谢。

1 个答案:

答案 0 :(得分:0)

data(mtcars) head(mtcars) mtcars$am <- as.factor(mtcars$am) library(ggplot2) library(GGally) lowerFn <- function(data, mapping, ...) { p <- ggplot(data = data, mapping = mapping) + geom_point(color = 'blue', alpha=0.3, size=4) + geom_smooth(color = 'black', method='lm', size=1,...) p } g <- ggpairs( data = mtcars, lower = list( continuous = wrap(lowerFn) #wrap("smooth", alpha = 0.3, color = "blue", lwd=1) ), upper = list(continuous = wrap("cor", size = 5)) ) g <- g + theme( axis.text = element_text(size = 6), axis.title = element_text(size = 6), legend.background = element_rect(fill = "white"), panel.grid.major = element_line(colour = NA), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "grey95") ) print(g, bottomHeightProportion = 0.5, leftWidthProportion = .5) 文件位于my-component.js目录中,因此将addon/component文件放在my-mixin.js目录中可以解决您的问题。