我正在尝试在 gatsby 中集成 Slick 滑块并通过自定义代码触发 Slick 方法。
我尝试编写类组件,但在如何从 shiopify 获取 GraphQL 产品列表并创建产品滑块方面遇到问题。任何帮助,将不胜感激。
我正在使用 gatsby-shopify-starter 开发一个电子商务项目
//import statements
export default class ProductSimilar extends Component {
constructor(props) {
super(props);
this.next = this.next.bind(this);
this.previous = this.previous.bind(this);
}
next() {
this.slider.slickNext();
}
previous() {
this.slider.slickPrev();
}
render() {
const data = useStaticQuery(
graphql`
query {
allShopifyProduct(
limit: 10,
sort: {
fields: [createdAt]
order: DESC
}
) {
edges {
node {
id
title
handle
createdAt
images {
id
originalSrc
localFile {
childImageSharp {
fluid(maxWidth: …Run Code Online (Sandbox Code Playgroud)