我安装了 material-ui-search-bar 然后我想使用 SearchBar。但我有下一个问题:
./node_modules/material-ui-search-bar/lib/components/SearchBar/SearchBar.js
Module not found: Can't resolve 'material-ui/AutoComplete' in '...node_modules/material-ui-search-bar/lib/components/SearchBar'
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
我有两个反应应用程序(A-app,B-app)。我需要将一个组件从 A-app 导入到 B-app。但是当我尝试这样做时,我看到了这个错误。
./src/App.js
Module not found: You attempted to import ../../src/components/Dashboard/container which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.
Run Code Online (Sandbox Code Playgroud)
我试图在 B-app node_modules 中的这个组件上做符号链接。但它没有用。
我还尝试在根项目目录中创建 .env 文件并将其放入NODE_PATH=src/
文件中。但是这个解决方案也不起作用。
我怎样才能解决这个问题?
对不起我的英语不好。
应用模型.py
class ColorSet(models.Model):
color = models.CharField(max_length=50, verbose_name='Color', default='', blank=True, null=True)
code = models.CharField(max_length=50, verbose_name='Code of color', default='', blank=True, null=True)
class Meta:
verbose_name = 'Color'
verbose_name_plural = 'Colors'
Run Code Online (Sandbox Code Playgroud)
还有 project.models.py
class Product(models.Model):
title = models.CharField(max_length=200, verbose_name='Title of product')
slug_field = models.SlugField(max_length=50, verbose_name='Slug', default='')
description = models.TextField(verbose_name='Description')
color_set = models.ForeignKey(ColorSet, verbose_name='Color', default='', blank=True, null=True)
def __str__(self):
return '%s %s %s' % (self.title, '->', self.category)
class Meta:
verbose_name = "Product"
verbose_name_plural = "Products"
Run Code Online (Sandbox Code Playgroud)
如果我在做“迁移”,我会看到这样的东西
Traceback (most recent call last):
File "manage.py", line 22, …Run Code Online (Sandbox Code Playgroud) reactjs ×2
django ×1
django-admin ×1
ecmascript-6 ×1
javascript ×1
material-ui ×1
python ×1
python-3.x ×1
react-redux ×1
redux ×1