首页 > 解决方案 > shopify 中的“为配置添加主题设置” - 错误消息“意外令牌”不断出现?

问题描述

我正在按照 shopify 开发人员的说明为我的网站创建“您是如何听说我们的表单字段”的。仅供参考,我在 Mac 上使用 safari。一切正常,直到我进入“为配置添加主题设置”的步骤。在配置中。settings_schema-json 目录下,当前代码(下)已经存在:

[
  {
    "name": "theme_info",
    "theme_name": "Themekit template theme",
    "theme_version": "1.0.0",
    "theme_author": "Shopify",
    "theme_documentation_url": "https:\/\/github.com\/Shopify\/themekit",
    "theme_support_url": "https:\/\/github.com\/Shopify\/themekit\/issues"
  }
]

我正在尝试使用下面从 shopify 开发人员粘贴的代码添加到该代码中,我被告知将其粘贴到右大括号(上图)下方的新行上。但是每次我这样做并点击保存时,都会出现两条错误消息(请参阅帖子底部的截图)。消息显示“错误阻止了 settings_schema.json 被保存”和“无效 JSON:意外令牌。” 有人知道这里出了什么问题吗?我将非常感激,因为我是编码新手,这是我第一次尝试对我的网站进行任何更改!

谢谢,科斯莫。

{
"name": "Hear About Us",
"settings": [
    {
        "type": "text",
        "id": "hau_form_options",
        "label": "Form options",
        "default": "Facebook, Twitter, Google, Instagram, Youtube",
        "info": "Separate each option with a comma"
    },
    {
        "type": "header",
        "content": "Form validation"
    },
    {
        "type": "checkbox",
        "id": "hau_form_validation",
        "label": "Enable form validation",
        "default": true
    },
    {
        "type": "text",
        "id": "hau_error_message",
        "label": "Error message",
        "info": "The error message that is displayed when no selection is made",
        "default": "Please select an option below"
    },
    {
        "type": "text",
        "id": "hau_error_message_other",
        "label": "Other field error message",
        "info": "The error message that is displayed when there is no input in the 'Other' field",
        "default": "Please fill the text field below"
    },
    {
        "type": "header",
        "content": "Error styling"
    },
    {
        "type": "color",
        "id": "hau_error_color",
        "label": "Color",
        "default": "#ff0000"
    }
]
},

截图错误信息

标签: configurationthemesschemashopifyunexpected-token

解决方案


缺少逗号,,更正它并且工作正常 在此处输入图像描述

更新:

在此处输入图像描述


推荐阅读