{"id":508,"date":"2020-02-26T16:55:25","date_gmt":"2020-02-26T08:55:25","guid":{"rendered":"https:\/\/blog.cqdefxxx.com\/?p=508"},"modified":"2020-02-26T16:55:25","modified_gmt":"2020-02-26T08:55:25","slug":"vue-%e7%82%b9%e5%87%bb%e5%8f%98%e8%89%b2","status":"publish","type":"post","link":"https:\/\/blog.viter.top\/index.php\/2020\/02\/26\/vue-%e7%82%b9%e5%87%bb%e5%8f%98%e8%89%b2\/","title":{"rendered":"Vue-\u70b9\u51fb\u53d8\u8272"},"content":{"rendered":"<pre class=\"pure-highlightjs\"><code class=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt;\n&lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"&gt;\n&lt;title&gt;Examples&lt;\/title&gt;\n&lt;meta name=\"description\" content=\"\"&gt;\n&lt;meta name=\"keywords\" content=\"\"&gt;\n&lt;link href=\"\" rel=\"stylesheet\"&gt;\n&lt;script type=\"text\/javascript\" src=\"lib\/vue.js\"&gt;&lt;\/script&gt;\n\n&lt;style&gt;\n  .active{\n    background: red;\n  }\n&lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div id=\"box\"&gt;\n       &lt;!-- &lt;ul&gt;\n          &lt;li v-for=\"item,index in datalist\"&gt;\n            {{item}}\n          &lt;\/li&gt;\n       &lt;\/ul&gt; --&gt;\n\n      &lt;!--  &lt;ul&gt;\n         &lt;li :class=\"isActive1?'active':''\"&gt;\u6b63\u5728\u70ed\u6620&lt;\/li&gt;\n         &lt;li :class=\"isActive2?'active':''\"&gt;\u5373\u5c06\u4e0a\u6620&lt;\/li&gt;\n       &lt;\/ul&gt; --&gt;\n\n\n       &lt;ul&gt;\n         &lt;li v-for=\"data,index in datalist\" :class=\"current===index?'active':''\" @click=\"handleClick(index)\"&gt;\n           {{data}}---{{index}}\n         &lt;\/li&gt;\n       &lt;\/ul&gt;\n    &lt;\/div&gt;\n\n    &lt;script type=\"text\/javascript\"&gt;\n        var vm = new Vue({\n           el:\"#box\",\n           data:{\n            isActive1:false,\n            isActive2:false,\n\n            current:0,\n            datalist:[\"1111\",\"2222\",\"33333\"]\n           },\n\n           methods:{\n            handleClick(index){\n              this.current = index;\n            }\n           }\n        })\n\n       var name=\"key\"\n\n       var mylocation= \"dalian\"\n\n       var obj = {\n          [name]: \"kerwin\",\n          mylocation,\n          getName(){\n\n          }\n       }\n\n        \/\/ \u65b0\u8001\u865a\u62dfdom\u5bf9\u6bd4\u7684 \u65f6\u5019 \u4f1a \u4f7f\u7528 diff \u7b97\u6cd5\u3002\n    &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[9,10],"_links":{"self":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/508"}],"collection":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/comments?post=508"}],"version-history":[{"count":0,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/508\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/media?parent=508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/categories?post=508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/tags?post=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}