cari

Rumah  >  Soal Jawab  >  teks badan

javascript - Mengenai menulis semula json dan menyimpannya

Sekeping data json dipaparkan pada halaman, cara klik dua kali pada kotak input untuk mengubah suai nilai dan menyimpannya

{
  "OpcUaClientConfig": {
    "endpointUrl": "opc.tcp://127.0.0.1:26545",
    "userName": "user1",
    "password": "password1",
    "securityMode": "NONE",
    "securityPolicy": "None",
    "timeout": 6000
  },
  "RedisConfig": {
    "Host": "127.0.0.1",
    "Port": 6379,
    "Password": "AUlSBQqy"
  },
  "MqttConfig": {
    "Protocol": "mqtt",
    "Host": "120.76.194.101",
    "Port": 1883,
    "UserName": "admin",
    "Password": "admin1702"
  },
  "Equiment": [
    {
      "Device": "Device1",
      "Group": "NC01",
      "DeviceID": "1",
      "Count": 0,
      "DeviceCode": "000100001000001",
      "Tags": [
        {
          "TagName": "progf",
          "Address": "ns=1;s=progf1",
          "ClientAccess": "RO",
          "ScanRate": "1000",
          "DataType": "",
          "Value": "",
          "Status": "",
          "Timestamp": ""
        },
        {
          "TagName": "ms",
          "Address": "ns=1;s=ms1",
          "ClientAccess": "RO",
          "ScanRate": "1000",
          "DataType": "",
          "Value": "",
          "Status": "",
          "Timestamp": ""
        }
      ]
    },
    {
      "Device": "Device1",
      "Group": "NC09",
      "DeviceID": "3",
      "Count": 0,
      "DeviceCode": "000100001000003",
      "Tags": [
        {
          "TagName": "progf",
          "Address": "ns=1;s=progf2",
          "ClientAccess": "RO",
          "ScanRate": "1000",
          "DataType": "",
          "Value": "",
          "Status": "",
          "Timestamp": ""
        },
        {
          "TagName": "ms",
          "Address": "ns=1;s=ms2",
          "ClientAccess": "RO",
          "ScanRate": "1000",
          "DataType": "",
          "Value": "",
          "Status": "",
          "Timestamp": ""
        }
      ]
    }
  ]
}

学习ing学习ing2701 hari yang lalu898

membalas semua(1)saya akan balas

  • 为情所困

    为情所困2017-07-05 10:50:37

    Ideanya adalah untuk pertama .json字符串通过.json()转成js对象...dan kemudian mengikat nilai pada input yang sepadan Ia akan menjadi lebih mudah jika anda menggunakan rangka kerja mvvm Anda juga boleh menulis pengikatan dua hala dalam js tulen boleh menggunakan perpustakaan penyuntingan json yang sudah siap, ini Mengesyorkan jsoneditor https://github.com/josdejong/jsoneditor/

    balas
    0
  • Batalbalas