{"id":1468,"date":"2019-01-27T11:43:52","date_gmt":"2019-01-27T02:43:52","guid":{"rendered":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1468"},"modified":"2019-01-27T11:43:52","modified_gmt":"2019-01-27T02:43:52","slug":"elementui%e3%81%aeform-item-attributes%e3%81%aeerror%e3%81%8c%e3%81%86%e3%81%be%e3%81%8f%e5%8b%95%e4%bd%9c%e3%81%97%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1468","title":{"rendered":"ElementUI\u306eForm-Item Attributes\u306eerror\u304c\u3046\u307e\u304f\u52d5\u4f5c\u3057\u306a\u3044"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u3084\u308a\u305f\u3044\u3053\u3068<\/h2>\n\n\n\n<p>\u73fe\u5728\u3001ElementUI\u3068Nuxt.js\u3067\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u3067\u767a\u751f\u3057\u305f\u30a8\u30e9\u30fc\uff08\u4e00\u610f\u5236\u7d04\u9055\u53cd\uff09\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092<br> Form-Item\u00a0Attributes\u306eerror\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u8868\u793a\u3055\u305b\u3066\u3044\u308b\u3051\u3069\u30012\u5ea6\u76ee\u306e\u64cd\u4f5c\u3067\u796d\u8868\u793a\u3055\u308c\u306a\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u66ab\u5b9a\u5bfe\u51e6<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/ElementUI\/lib\/blob\/master\/form-item.js\">\u30bd\u30fc\u30b9<\/a>\u3092\u307f\u308b\u3068error\u3092watch\u3057\u3066\u3044\u308b\u3051\u3069\u3001\u305d\u306e\u4e2d\u3067\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u306e\u5224\u5b9a\u3092\u64cd\u4f5c\u3057\u3066\u3044\u308b\u3002\u591a\u5206watch\u306e\u53cd\u6620\u304c\u3055\u308c\u308b\u524d\u306b\u3001\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u304c\u8d70\u3063\u3066\u3044\u308b\u6a21\u69d8\u3002<\/p>\n\n\n\n<p>\u53d6\u308a\u6562\u3048\u305a\u3001\u5f85\u3061\u306e\u51e6\u7406\u3092\u5165\u308c\u3066\u5bfe\u7b56\u3002\u304d\u3061\u3093\u3068\u540c\u671f\u3092\u3055\u305b\u3066\u3044\u306a\u3044\u304c\u305d\u3082\u305d\u3082\u3053\u3093\u306a\u72b6\u6cc1\u306b\u306a\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u4f55\u304b\u3001\u5165\u308a\u53e3\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u6c17\u304c\u3059\u308b\u3002<a href=\"https:\/\/teratail.com\/questions\/170955\">terateil<\/a>\u306b\u521d\u3081\u3066\u8cea\u554f\u3057\u3066\u307f\u305f\u3051\u3069\u307e\u3060\u56de\u7b54\u306f\u306a\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30bd\u30fc\u30b9<\/h2>\n\n\n\n<p>\u629c\u7c8b\u3002(\u5168\u90e8\u306fterateil\u306b\u5f35\u3063\u3066\u304a\u3044\u305f\uff09<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;template>\n  &lt;section class=\"container\">\n    &lt;el-form\n      ref=\"userForm\"\n      :model=\"userForm\"\n      :rules=\"rules\"\n      @submit.native.prevent>\n      &lt;el-form-item\n        ref=\"nickname\"\n        :error=\"errorMessage\"\n        label=\"\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u3092\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002\"\n        prop=\"nickname\">\n        &lt;el-input\n          v-model=\"userForm.nickname\"\n          type=\"text\"\n          autocomplete=\"off\"\/>\n      &lt;\/el-form-item>\n      &lt;el-button\n        type=\"primary\"\n        @click=\"registNickName\">\u767b\u9332&lt;\/el-button>\n    &lt;\/el-form>\n\n  &lt;\/section>\n&lt;\/template>\n\n&lt;script>\n\nexport default {\n  data: function() {\n    return {\n      userForm: {\n        nickname: ''\n      },\n      errorMessage: '',\n      rules: {\n        nickname: [\n          {\n            required: true,\n            whitespace: true,\n            message: '\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u306f\u5fc5\u305a\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002'\n          }\n        ]\n      }\n    }\n  },\n  methods: {\n    registNickName: async function() {\n        \/\/ \u4e00\u610f\u5236\u7d04\uff08\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u91cd\u8907\uff09\n\n        \/*\n          XXX 2\u5ea6\u76ee\u306e\u6642\u306bthis.error\u3092\u4e00\u5ea6\u30af\u30ea\u30a2\u3057\u306a\u3044\u3068\u767a\u706b\u3057\u306a\u3044\u3002\n          \u305f\u3060\u3057\u3001\u5c11\u3057\u307e\u3063\u3066\u3084\u3089\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002\n          \u30c7\u30fc\u30bf\u306e\u5909\u66f4\u304c\u975e\u540c\u671f\u306b\u8d70\u3063\u3066\u3044\u308b\u304b\u3089\u6574\u5408\u6027\u304c\u3068\u308c\u306a\u304f\u306a\u3063\u3066\u3044\u308b\uff1f\n         *\/\n        this.errorMessage = ''\n        await new Promise(function(resolve, reject) {\n          window.setTimeout(resolve, 10)\n        })\n        const duplicateMessage =\n          this.userForm.nickname +\n          '\u306f\u65e2\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u5225\u306e\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002'\n        this.errorMessage = duplicateMessage\n\n        return\n\n    }\n  }\n}\n&lt;\/script>\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u3044\u3064\u3082\u3069\u304a\u308a\u95a2\u4fc2\u306a\u3044\u3051\u3069<br><\/h2>\n\n\n\n<p>\u63b2\u8f09\u3057\u3066\u3082\u3089\u3063\u305f<a href=\"http:\/\/bouldering-log.com\/?post_type=kansai&amp;p=2417\">BOLLOG<\/a>\u306e\u30ea\u30f3\u30af\u304cgoogle\u306b\u8a8d\u8b58\u3055\u308c\u306a\u3044\u3002\u5927\u624b\u3060\u3051\u3069\u66f4\u65b0\u304c\u3057\u3070\u3089\u304f\u6b62\u307e\u3063\u3066\u308b\u3068\u30af\u30ed\u30fc\u30e9\u30fc\u898b\u306b\u884c\u304b\u306a\u3044\u306e\u304b\u306a\uff1f\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3084\u308a\u305f\u3044\u3053\u3068 \u73fe\u5728\u3001ElementUI\u3068Nuxt.js\u3067\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u3067\u767a\u751f\u3057\u305f\u30a8\u30e9\u30fc\uff08\u4e00\u610f\u5236\u7d04\u9055\u53cd\uff09\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092 Form-Item\u00a0Attributes\u306eerror\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u8868\u793a\u3055\u305b\u3066\u3044\u308b\u3051\u3069\u30012\u5ea6\u76ee\u306e\u64cd\u4f5c\u3067\u796d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[115],"tags":[],"class_list":["post-1468","post","type-post","status-publish","format-standard","hentry","category-vue"],"_links":{"self":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1468"}],"version-history":[{"count":1,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1468\/revisions"}],"predecessor-version":[{"id":1469,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1468\/revisions\/1469"}],"wp:attachment":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}