{"id":13995,"date":"2025-12-11T10:00:00","date_gmt":"2025-12-11T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=13995"},"modified":"2025-12-10T20:02:18","modified_gmt":"2025-12-10T11:02:18","slug":"vue-js%e3%81%ae%e5%9f%ba%e6%9c%ac-3","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/13995","title":{"rendered":"Vue.js\u306e\u57fa\u672c #3"},"content":{"rendered":"\n<p>\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304dJavaScript\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306eVue.js\u306e\u57fa\u672c\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<br>Vue.js\u306f\u3001HTML\u306b\u52d5\u304d\u3092\u3064\u3051\u305f\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u306b\u5fdc\u3058\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u753b\u9762\u3092\u66f4\u65b0\u3057\u305f\u308a\u3059\u308b\u305f\u3081\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002<br>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Vue.js\u306e\u4e2d\u3067\u3082\u7279\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u69cb\u6587\uff08HTML\u5074\uff09 \u3068 \u30ed\u30b8\u30c3\u30af\uff08JavaScript\u5074\uff09\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3>JavaScript\u5074\u306e\u57fa\u672c\u69cb\u9020<\/h3>\n\n\n\n<p>Vue 3 \u3067\u306f Composition API\uff08setup\u95a2\u6570\uff09 \u3068 Options API\uff08data, methods, computed\u306a\u3069\uff09 \u306e2\u901a\u308a\u304c\u3042\u308a\u307e\u3059\u3002<br>\u4eca\u56de\u306f Options API\uff08data, methods, computed\u306a\u3069\uff09\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4>data()\uff1aOptions API\u3067\u30c7\u30fc\u30bf\u3092\u5b9a\u7fa9\u3059\u308b<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>export default {\n  data() {\n    return {\n      message: '\u3053\u3093\u306b\u3061\u306f\uff01',\n      count: 0\n    };\n  }\n};<\/code><\/pre>\n\n\n\n<p>data() \u306f\u753b\u9762\u3067\u4f7f\u3046\u30c7\u30fc\u30bf\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<br>\u623b\u308a\u5024\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304cVue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4>computed\uff1a\u8a08\u7b97\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u30ea\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u5024\u306e\u52a0\u5de5\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>export default {\n  data() {\n    return { price: 100, taxRate: 0.1 };\n  },\n  computed: {\n    totalPrice() {\n      return this.price * (1 + this.taxRate);\n    }\n  }\n};<\/code><\/pre>\n\n\n\n<p>computed \u306f\u3001\u4ed6\u306e\u30c7\u30fc\u30bf\u304b\u3089\u81ea\u52d5\u7684\u306b\u8a08\u7b97\u3055\u308c\u308b\u5024\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<br>\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u308b\u305f\u3081\u3001\u7121\u99c4\u306a\u518d\u8a08\u7b97\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n\n\n\n<h4>methods\uff1a\u95a2\u6570\uff08\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u306a\u3069\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>export default {\n  data() {\n    return { count: 0 };\n  },\n  methods: {\n    increment() {\n      this.count++;\n    }\n  }\n};<\/code><\/pre>\n\n\n\n<p>\u30a4\u30d9\u30f3\u30c8\u6642\u306e\u52d5\u4f5c\u306a\u3069\u3092\u95a2\u6570\u3068\u3057\u3066\u307e\u3068\u3081\u3066\u304a\u304f\u5834\u6240\u3067\u3059\u3002<br>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u306f @click=&#8221;increment&#8221; \u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<h4>mounted\uff1a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u305f\u3042\u3068\u306b\u5b9f\u884c<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>export default {\n  mounted() {\n    console.log('\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u30de\u30a6\u30f3\u30c8\u3055\u308c\u307e\u3057\u305f\uff01');\n  }\n};<\/code><\/pre>\n\n\n\n<p>mounted() \u306fVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5b9f\u969b\u306bDOM\u306b\u63cf\u753b\u3055\u308c\u305f\u76f4\u5f8c\u306b\u547c\u3070\u308c\u307e\u3059\u3002<br>API\u30c7\u30fc\u30bf\u53d6\u5f97\u3084\u521d\u671f\u8a2d\u5b9a\u306a\u3069\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6728\u66dc\u65e5\u62c5\u5f53\uff1anishida<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13995\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/13995\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Vue.js\u306e\u57fa\u672c #3\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13995\" data-text=\"Vue.js\u306e\u57fa\u672c #3\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13995\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13995\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304dJavaScript\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306eVue.js\u306e\u57fa\u672c\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002Vue.js\u306f\u3001HTML\u306b\u52d5\u304d\u3092\u3064\u3051\u305f\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u306b\u5fdc\u3058\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u753b\u9762\u3092\u66f4\u65b0\u3057\u305f\u308a\u3059\u308b\u305f\u3081\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067 [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13995"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=13995"}],"version-history":[{"count":3,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13995\/revisions"}],"predecessor-version":[{"id":14000,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13995\/revisions\/14000"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=13995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=13995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=13995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}