我正在尝试使用参数实现从 API 获取数据。我有两个函数,但我看不到错误。有任何想法吗?
getFilteredProducts() {
return apiClient.get('/product/', {
params: {
search: String(name)
}
})
}
Run Code Online (Sandbox Code Playgroud)
async fetchFilteredProducts({ commit }, name) {
await productService.getFilteredProducts({name})
.then(response => {
commit('SET_FILTERED_PRODUCTS', response.data.items)
})
.catch(error => {
console.log('Error has occured' + error)
})
}
Run Code Online (Sandbox Code Playgroud)
我收到了以下代码的工作解决方案,因此问题可能与第二个参数有关。
async fetchFilteredProducts({ commit }, name) {
await axios.get("MY_API_URL/product/", {
params: {
search: String(name)
}
})
.then(response => {
commit('SET_FILTERED_PRODUCTS', response.data.items)
})
Run Code Online (Sandbox Code Playgroud) 我正在使用SQLAlchemy和SQLite创建我的第一个数据库项目。我想将两个实体连接为关系数据库的关系模型。来源如下:
class Models(Base):
__tablename__ = "models"
id_model = Column(Integer, primary_key=True)
name_of_model = Column(String, nullable = False)
price = Column(Integer, nullable = False)
def __init__(self, name_of_model):
self.name_of_model = name_of_model
class Cars(Base):
__tablename__ = "cars"
id_car = Column(Integer, primary_key=True)
id_equipment = Column(Integer, nullable = False)
id_package = Column(Integer, nullable = False)
id_model = Column(Integer, ForeignKey('Models'))
model = relationship("Models", backref=backref('cars', order_by = id_model))
Run Code Online (Sandbox Code Playgroud)
我想建立这样的关系:https : //imgur.com/af62zli
发生的错误是:
The foreign key associated with column 'cars.id_model' could not find table 'Models' with which to …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ApexCharts将饼图添加到我的网站。我已经从他们的网站复制了源代码,但在我网站的控制台中收到错误“无法将类作为函数调用”。
删除此行时错误消失:
<vue-apex-charts type="pie" width="380" :options="chartOptions" :series="series"> </vue-apex-charts>
Run Code Online (Sandbox Code Playgroud)
也许有一个小问题。
来自文件 PieChart.vue 的源代码
<template>
<div id="chart">
<vue-apex-charts type="pie" width="380" :options="chartOptions" :series="series"> </vue-apex-charts>
</div>
</template>
<script>
import VueApexCharts from 'apexcharts'
export default {
name: 'PieChart',
components: { VueApexCharts },
data () {
return {
series: [44, 55, 13, 43, 22],
chartOptions: {
labels: ['Team A', 'Team B', 'Team C', 'Team D', 'Team E'],
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
} …Run Code Online (Sandbox Code Playgroud)