{"id":978,"date":"2023-03-23T22:41:43","date_gmt":"2023-03-23T14:41:43","guid":{"rendered":""},"modified":"2023-03-23T22:41:43","modified_gmt":"2023-03-23T14:41:43","slug":"Vue.js \u4e8b\u4ef6","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/978.html","title":{"rendered":"Vue.js \u4e8b\u4ef6"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

Vue.js \u4e8b\u4ef6<\/h1>\n<\/p><\/div>\n
\n \u5728Vue.js\u4e2d\uff0c\u4e8b\u4ef6\u7528\u4e8e\u54cd\u5e94\u52a8\u4f5c\u3002\u5047\u8bbe\u60a8\u5fc5\u987b\u4f7f\u7528Vue.js\u6784\u5efa\u4e00\u4e2a\u52a8\u6001\u7f51\u7ad9\uff0c\u90a3\u4e48\u60a8\u5f88\u53ef\u80fd\u5e0c\u671b\u5b83\u80fd\u591f\u54cd\u5e94\u4e8b\u4ef6\u3002\n <\/div>\n
\n \u4f8b\u5982\uff0c\u5982\u679c\u60a8\u7684Vue.js\u7f51\u7ad9\u5177\u6709\u53ef\u70b9\u51fb\u7684\u6309\u94ae\uff0c\u8868\u5355\u7b49\u7b49\uff0c\u60a8\u80af\u5b9a\u5e0c\u671b\u5982\u679c\u7528\u6237\u5355\u51fb\u6309\u94ae\uff0c\u63d0\u4ea4\u8868\u5355\u6216\u4ec0\u81f3\u79fb\u52a8\u5176\u9f20\u6807Vue.js\u7f51\u7ad9\u90fd\u4f1a\u4ee5\u67d0\u79cd\u65b9\u5f0f\u505a\u51fa\u54cd\u5e94\u3002\n <\/div>\n

Vue.js\u4e8b\u4ef6\u5904\u7406<\/h3>\n
\n \u8981\u4f7f\u7528
\n Vue.js \u5904\u7406\u4e8b\u4ef6\uff0c\u6211\u4eec\u5fc5\u987b\u5c06v-on\u6307\u4ee4\u6dfb\u52a0\u5230\u76f8\u5173\u7684DOM\u5143\u7d20\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8981\u5904\u7406\u6309\u94ae\u5143\u7d20\u7684\u5355\u51fb\uff0c\u5219\u5e94\u5728Vue\u6a21\u677f\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801:\n <\/div>\n
\n \u8bed\u6cd5: <\/strong>\n <\/div>\n
\n
 <button v-on:click=\"clickHandler\"><\/button><\/span> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4fbf\u6377\u7684\u901f\u8bb0
\n @ <\/strong>\u4ee3\u66ffv-on\u6307\u4ee4\u3002\u770b\u8d77\u6765\u50cf\u8fd9\u6837:\n <\/div>\n
\n
 <button @click=\"clickHandler\"><\/button><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6211\u4eec\u5728v-on\u6307\u4ee4\u4e2d\u6dfb\u52a0\u4e86\u4e00\u4e2a\u53c2\u6570\uff0c\u8fd9\u5c06\u662f\u6211\u4eec\u8981\u5904\u7406\u7684\u4e8b\u4ef6\u7684\u540d\u79f0\u3002\u5728\u4e0a\u8ff0\u793a\u4f8b\u60c5\u51b5\u4e0b\uff0c\u8fd9\u662f\u4e00\u4e2aclick\u4e8b\u4ef6\u3002\u4e4b\u540e\uff0c\u6211\u4eec\u5fc5\u987b\u5c06\u8868\u8fbe\u5f0f\u7ed1\u5b9a\u5230\u6307\u4ee4\uff0c\u8be5\u6307\u4ee4\u901a\u5e38\u662f\u60a8\u8981\u7528\u4e8e\u5904\u7406\u4e8b\u4ef6\u7684\u65b9\u6cd5\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5c06\u5176\u79f0\u4e3aclickHandler\u3002\n <\/div>\n

\u60a8\u53ef\u4ee5\u5904\u7406\u7684Vue.js\u4e8b\u4ef6\u7684\u7c7b\u578b<\/h3>\n
\n \u60a8\u53ef\u4ee5\u5904\u7406\u5f88\u591a\u5176\u4ed6\u7684Vue.js\u9664\u70b9\u51fb\u4e4b\u5916\u7684DOM\u4e8b\u4ef6\u3002 Vue.js\u53ef\u4ee5\u5904\u7406\u4efb\u4f55\u7c7b\u578b\u7684Web\u6216\u79fb\u52a8\u672c\u673a\u4e8b\u4ef6\u4ee5\u53ca\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u3002\u901a\u5e38\u7528\u4e8e\u5904\u7406\u7684\u6700\u5e38\u89c1\u4e8b\u4ef6:\n <\/div>\n

submit<\/span>
\n keyup <\/span>
\n drag<\/span>
\n scroll<\/span>
\n error<\/span>
\n abort<\/span>
\n mouseover<\/span>
\n mouseout<\/span>
\n load\u7b49<\/span> <\/p>\n

\u4e8b\u4ef6\u5904\u7406\u65b9\u6cd5<\/h2>\n
\n \u8ba9\u6211\u4eec\u770b\u4e00\u4e9b\u90e8\u7f72\u4e8b\u4ef6\u5904\u7406\u65b9\u6cd5\u7684\u7b80\u5355\u793a\u4f8b\u3002\n <\/div>\n

\u70b9\u51fb\u4e8b\u4ef6<\/h3>\n
\n \u8bf7\u53c2\u89c1\u4ee5\u4e0b\u793a\u4f8b\uff0c\u4ee5\u6f14\u793aVue.js\u4e2d\u7684\u70b9\u51fb\u4e8b\u4ef6\u5904\u7406\u3002\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
      <div id=\"app\">
  <button v-on:click = \"displaynumbers\">Click Me to Add No.<\/button><\/span>
         <h2><\/span> Add Number 100 + 200 = {{total}}<\/h2><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 var vm = new Vue({
            el: \"#app\",
            data: {
               num1: 50,
               num2 : 100,
               total : ''
            },
            methods : {
               displaynumbers : function(event) {
                  console.log(event);
                  return this.total = this.num1+ this.num2;
               }
            },
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6211\u4eec\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684CSS\u6587\u4ef6\u4f7f\u8f93\u51fa\u66f4\u5177\u5438\u5f15\u529b\u3002\n <\/div>\n
\n Index.css\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 html, body {
    margin: 5px;
    padding: 0;
}
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7a0b\u5e8f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c1\u5f20 <\/p>\n

\n \u5355\u51fb\u4e0a\u9762\u7684\u6309\u94ae\u65f6\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u5b83\u5df2\u7ecf\u6dfb\u52a0\u4e86\u53f7\u7801\u3002\u53c2\u89c1\u8f93\u51fa:\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c2\u5f20 <\/p>\n

\u793a\u4f8b\u8bf4\u660e<\/h3>\n
\n \u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4e3aDOM\u5143\u7d20\u5206\u914d\u4e86\u4ee5\u4e0bclick\u4e8b\u4ef6\u3002\n <\/div>\n
\n
 <button v-on:click = \"displaynumbers\">Click Me to Add No.<\/button><\/span> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5f53\u60a8\u5355\u51fb\u6309\u94ae\u65f6\uff0c\u5b83\u5c06\u8c03\u7528\u65b9\u6cd5\"
\n displaynumbers <\/strong>\"\uff0c\u8be5\u65b9\u6cd5\u5c06\u5728\u4e8b\u4ef6\u4e2d\u63a5\u6536\u5e76\u770b\u5230\u8f93\u51fa\u3002\n <\/div>\n
\n \u6211\u4eec\u8fd8\u53ef\u4ee5\u5206\u914d
\n @ <\/strong>\u7684\u7f29\u5199\uff0c\u800c\u4e0d\u662fv-on\u6307\u4ee4\u3002\u60a8\u53ef\u4ee5\u8c03\u7528\u4ee5\u4e0b\u4e8b\u4ef6\uff0c\u7ed3\u679c\u5c06\u76f8\u540c\u3002\n <\/div>\n
\n
 <button @click = \"displaynumbers\">Click ME<\/button><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n

\u9f20\u6807\u60ac\u505c\u548c\u9f20\u6807\u79fb\u51fa\u4e8b\u4ef6<\/h3>\n
\n \u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u68c0\u67e5\u4e24\u4e2a\u65b0\u7684\u540d\u4e3a
\n mouseover <\/strong>\u548c
\n mouseout <\/strong>\u7684Vue.js\u4e8b\u4ef6\u3002\u8bf7\u53c2\u89c1\u4ee5\u4e0b\u793a\u4f8b\u3002\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
      <div id = \"databinding\">
         <div v-bind:style = \"styleobj\" v-on:mouseover = \"changebgcolor\" v-on:mouseout = \"originalcolor\"><\/div><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
          var vm = new Vue({
            el: '#databinding',
            data: {
               num1: 100,
               num2 : 200,
               total : '',
               styleobj : {
                  width:\"100px\",
                  height:\"100px\",
                  backgroundColor:\"red\"
               }
            },
            methods : {
               changebgcolor : function() {
                  this.styleobj.backgroundColor = \"blue\";
               },
               originalcolor : function() {
                  this.styleobj.backgroundColor = \"brown\";
               }
            },
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7a0b\u5e8f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c3\u5f20 <\/p>\n

\n \u60a8\u53ef\u4ee5\u5728\u8f93\u51fa\u4e2d\u770b\u5230\u9ed8\u8ba4\u80cc\u666f\u8272\u4e3a
\n \u7ea2\u8272<\/strong>\u3002\u73b0\u5728\uff0c\u5c06\u9f20\u6807\u5149\u6807\u79fb\u5230\u8be5\u6846\u4e0a\uff0c\u8be5\u6846\u7684\u989c\u8272\u5c06\u66f4\u6539\u4e3a
\n \u84dd\u8272<\/strong>\u3002\u53c2\u89c1\u8f93\u51fa\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c4\u5f20 <\/p>\n

\n \u73b0\u5728\uff0c\u5c06\u9f20\u6807\u5149\u6807\u79fb\u51fa\u6846\uff0c\u5e76\u4e14\u6846\u7684\u989c\u8272\u5c06\u66f4\u6539\u4e3a
\n \u68d5\u8272<\/strong>\u3002\u53c2\u89c1\u8f93\u51fa\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c5\u5f20 <\/p>\n

\u793a\u4f8b\u8bf4\u660e<\/h3>\n
\n \u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2adiv\u5143\u7d20\uff0c\u5176\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u4e3a100px\u3002\u8be5div\u7684\u9ed8\u8ba4\u80cc\u666f\u989c\u8272\u662f\u7ea2\u8272\u3002\u5728
\n \u9f20\u6807\u60ac\u505c<\/strong>\u4e0a\uff0c\u80cc\u666f\u989c\u8272\u66f4\u6539\u4e3a\u84dd\u8272\uff0c\u5728
\n \u9f20\u6807\u60ac\u505c<\/strong>\u4e0a\u80cc\u666f\u989c\u8272\u66f4\u6539\u4e3a\u68d5\u8272\u3002\n <\/div>\n
\n \u5728\u9f20\u6807\u60ac\u505c\u671f\u95f4\uff0c\u79f0\u4e3achangebgcolor\uff0c\u5c06\u9f20\u6807\u79fb\u51fadiv\u540e\uff0c\u4e00\u79cd\u65b9\u6cd5\u79f0\u4e3aoriginalcolor\u3002\n <\/div>\n
\n
 <div v-bind:style = \"styleobj\" v-on:mouseover = \"changebgcolor\" v-on:mouseout = \"originalcolor\"><\/div><\/span> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u4e24\u4e2a\u4e8b\u4ef6mouseover\u548cmouseout\u5e76\u5c06\u5b83\u4eec\u5206\u914d\u7ed9div\u3002\n <\/div>\n
\n \u4f7f\u7528
\n v-bind: style =\"styleobj\" <\/strong>\u5c06\u76f8\u540c\u7684\u53d8\u91cf\u7ed1\u5b9a\u5230div\u3002 \u3002\u5728changebgcolor\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u5c06\u989c\u8272\u66f4\u6539\u4e3a\u7eff\u8272\u3002\n <\/div>\n
\n
 changebgcolor : function() {
   this.styleobj.backgroundColor = \"blue\";
}
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528stylobj\u53d8\u91cf\uff0c\u989c\u8272\u53d8\u4e3a\u7eff\u8272\u3002\u540c\u6837\uff0c\u6211\u4eec\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u5c06\u989c\u8272\u66f4\u6539\u4e3a\u68d5\u8272\n <\/div>\n
\n
 originalcolor : function() {
   this.styleobj.backgroundColor = \"brown\";
<\/span><\/code><\/pre>\n<\/p><\/div>\n

Vue.js\u4e8b\u4ef6\u4fee\u9970\u7b26<\/h3>\n
\n Vue.js\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5728v-on\u5c5e\u6027\u4e0a\u53ef\u7528\u7684\u4e8b\u4ef6\u4fee\u9970\u7b26\u3002\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5728\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u4e2d\u8c03\u7528event.preventDefault()\u6216event.stopPropagation()\u3002\u8fd9\u91cc\uff0c.prevent\u548c.stop\u662f\u4e8b\u4ef6\u4fee\u9970\u7b26\u3002\n <\/div>\n
\n \u8fd9\u4e9b\u4fee\u9970\u7b26\u662f\u7528\u70b9\u8868\u793a\u7684\u6307\u4ee4\u540e\u7f00\u3002\u4ee5\u4e0b\u662fv-on\u5c5e\u6027\u4e0a\u53ef\u7528\u7684\u6700\u5e38\u89c1\u4fee\u9970\u7b26\u7684\u5217\u8868:\n <\/div>\n

.once <\/span>
\n .prevent <\/span>
\n .stop <\/span>
\n .capture <\/span>
\n .self <\/span>
\n .passive <\/span> <\/p>\n

.once\u4e8b\u4ef6\u4fee\u9970\u7b26<\/h3>\n
\n \u5b83\u4ec5\u5141\u8bb8\u4e8b\u4ef6\u6267\u884c\u4e00\u6b21\u3002\n <\/div>\n
\n \u8bed\u6cd5: <\/strong>\n <\/div>\n
\n
 <button v-on:click.once = \"buttonclicked\">Click Once<\/button><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5fc5\u987b\u5728\u8c03\u7528\u4fee\u9970\u7b26\u65f6\u6dfb\u52a0\u70b9\u8fd0\u7b97\u7b26\uff0c\u5982\u4e0a\u9762\u7684\u8bed\u6cd5\u6240\u793a\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u4ee5\u4e86\u89e3\u4e00\u6b21\u4fee\u9970\u7b26\u7684\u6982\u5ff5\u548c\u5de5\u4f5c\u539f\u7406\u3002\n <\/div>\n
\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
      <div id = \"eg_2\">
         <button v-on:click.once = \"buttonclickedonce\" v-bind:style = \"styleobj\">Just once clickable<\/button><\/span>
         Output:{{clicknum}}
         <br\/><br\/>
         <button v-on:click = \"buttonclicked\" v-bind:style = \"styleobj\">Click Me anytime<\/button><\/span>
         Output:{{clicknum1}}
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 var vm = new Vue({
            el: '#eg_2',
            data: {
               clicknum : 0,
               clicknum1 :0,
               styleobj: {
                  backgroundColor: '#2196F3!important',
                  cursor: 'pointer',
                  padding: '8px 16px',
                  verticalAlign: 'middle',
               }
            },
            methods : {
               buttonclickedonce : function() {
                  this.clicknum++;
               },
               buttonclicked : function() {
                  this.clicknum1++;
               }
            }
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7a0b\u5e8f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c6\u5f20 <\/p>\n

\n \u60a8\u53ef\u4ee5\u770b\u5230\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\u6211\u4eec\u521b\u5efa\u4e86\u4e24\u4e2a\u6309\u94ae\u3002\u5e26\u6709\"\u53ea\u9700\u5355\u51fb\u4e00\u6b21\"\u6807\u7b7e\u7684\u6309\u94ae\u6dfb\u52a0\u4e86\u4e00\u6b21\u4fee\u9970\u7b26\uff0c\u800c\u53e6\u4e00\u4e2a\u6309\u94ae\u5219\u6ca1\u6709\u4efb\u4f55\u4fee\u9970\u7b26\u3002\n <\/div>\n
\n
 <button v-on:click.once = \"buttonclickedonce\" v-bind:style = \"styleobj\">Just once clickable<\/button><\/span>
<button v-on:click = \"buttonclicked\" v-bind:style = \"styleobj\">Click Me anytime<\/button><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5f53\u60a8\u5355\u51fb\u7b2c\u4e00\u4e2a\u6309\u94ae\u65f6\uff0c\u5b83\u5c06\u8c03\u7528\u65b9\u6cd5\" buttonclickedonce\"\uff0c\u800c\u5728\u5355\u51fb\u7b2c\u4e8c\u4e2a\u6309\u94ae\u540e\uff0c\u5b83\u5c06\u8c03\u7528\u65b9\u6cd5\" buttonclicked\"\u3002\n <\/div>\n
\n
 buttonclickedonce : function() {
   this.clicknum++;
},
buttonclicked : function() {
   this.clicknum1++;
}
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6211\u4eec\u8fd8\u5728
\n clicknum <\/strong>\u548c
\n clicknum1 <\/strong>\u4e2d\u5b9a\u4e49\u4e86\u4e24\u4e2a\u53d8\u91cf\u3002\u5355\u51fb\u6309\u94ae\u65f6\uff0c\u4e24\u8005\u90fd\u4f1a\u589e\u52a0\u3002\u8fd9\u4e24\u4e2a\u53d8\u91cf\u90fd\u521d\u59cb\u5316\u4e3a0\u3002\u60a8\u53ef\u4ee5\u5728\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\u770b\u5230\u5b83\u3002\n <\/div>\n
\n \u5355\u51fb\u7b2c\u4e00\u4e2a\u6309\u94ae\u65f6\uff0c\u53d8\u91cfclicknum\u9012\u589e1\u3002\u5728\u7b2c\u4e8c\u6b21\u5355\u51fb\u65f6\uff0c\u6570\u5b57\u4e0d\u9012\u589e\u4e3a\u4fee\u9970\u7b26\u53ef\u9632\u6b62\u5176\u6267\u884c\u6216\u6267\u884c\u5355\u51fb\u6309\u94ae\u65f6\u5206\u914d\u7684\u4efb\u4f55\u64cd\u4f5c\u9879\u3002\n <\/div>\n
\n \u5355\u51fb\u7b2c\u4e8c\u4e2a\u6309\u94ae\u65f6\uff0c\u5c06\u6267\u884c\u76f8\u540c\u7684\u64cd\u4f5c\uff0c\u5373\u53d8\u91cf\u589e\u52a0\u3002\u6bcf\u6b21\u5355\u51fb\u65f6\uff0c\u8be5\u503c\u90fd\u4f1a\u589e\u52a0\u5e76\u663e\u793a\u3002\u8bf7\u53c2\u9605\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c7\u5f20 <\/p>\n

\n \u5728\u4e24\u6b21\u5355\u51fb\u4e24\u4e2a\u6309\u94ae\u4e4b\u540e\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u7b2c\u4e00\u4e2a\u6309\u94ae\u4ec5\u663e\u793a\u4e00\u6b21\u5355\u51fb\uff0c\u7b2c\u4e8c\u4e2a\u6309\u94ae\u663e\u793a\u4e865\u6b21\u3002\n <\/div>\n

\u3002prevent\u4e8b\u4ef6\u4fee\u9970\u7b26<\/h3>\n
\n \u4f7f\u7528\u4e86.prevent\u4e8b\u4ef6\u4fee\u9970\u7b26\u5f53\u60a8\u4e0d\u60f3\u901a\u8fc7\u5355\u51fb\u6309\u94ae\u6253\u5f00\u7279\u5b9a\u7684ID\u6216URL\u65f6\u3002\n <\/div>\n
\n \u8bed\u6cd5: <\/strong>\n <\/div>\n
\n
 <a href = \"An specific url\" v-on:click.prevent = \"clickme\">Click Me<\/a><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8ba9\u6211\u4eec\u770b\u4e24\u4e2a\u793a\u4f8b\uff0c\u4e00\u4e2a\u4e0d\u5e26.prevent\u4e8b\u4ef6\u4fee\u9970\u7b26\uff0c\u53e6\u4e00\u4e2a\u5e26\u5b83\u6e05\u695a\u5730\u7406\u89e3\u5b83\u3002\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
      <div id = \"eg_3\">
         <a href = \"http:\/\/www.google.com\" v-on:click = \"clickme\" target = \"_blank\" v-bind:style = \"styleobj\">Click Me<\/a><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 var vm = new Vue({
            el: '#eg_3',
            data: {
               clicknum : 0,
               clicknum1 :0,
               styleobj: {
                  color: '#4CAF50',
                  marginLeft: '20px',
                  fontSize: '30px'
               }
            },
            methods : {
               clickme : function() {
                  alert(\"Anchor tag is clicked\");
               }
            }
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7a0b\u5e8f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c8\u5f20 <\/p>\n

\n \u5f53\u60a8\u5355\u51fb\"\u5355\u51fb\u6211\"\u6309\u94ae\u65f6\uff0c\u60a8\u4f1a\u770b\u5230\u4e00\u6761\u5f39\u51fa\u6d88\u606f\u3002\u53c2\u89c1\u4e0b\u56fe\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c9\u5f20 <\/p>\n

\n \u70b9\u51fb\"\u786e\u5b9a\"\u6309\u94ae\u540e\uff0c\u76ee\u6807\u7f51\u5740\u5c06\u5982\u4e0b\u56fe\u6240\u793a\u6253\u5f00:\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c10\u5f20 <\/p>\n

\n \u73b0\u5728\uff0c\u6211\u4eec\u5c06\u4f7f\u7528.prevent\u4e8b\u4ef6\u4fee\u9970\u7b26\u67e5\u770b\u7ed3\u679c\u3002\u5728Index.html\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u3002\n <\/div>\n
\n
 <a href = \"http:\/\/www.google.com\" v-on:click.prevent = \"clickme\" target = \"_blank\" v-bind:style = \"styleobj\">Click Me<\/a><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6dfb\u52a0\u4ee3\u7801\u540e\uff0c\u5982\u679c\u5355\u51fb\u6309\u94ae\uff0c\u5b83\u5c06\u53d1\u9001\u8b66\u62a5\u6d88\u606f\uff0c\u4f46\u4e0d\u518d\u6253\u5f00URL\u3002\n <\/div>\n
\n \u7528\u4ee5\u4e0b\u5185\u5bb9\u66ff\u6362Index.html\u6587\u4ef6\u4ee3\u7801: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
      <div id = \"eg_3\">
        <a href = \"http:\/\/www.google.com\" v-on:click.prevent = \"clickme\" target = \"_blank\" v-bind:style = \"styleobj\">Click Me<\/a><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c11\u5f20 <\/p>\n

\n \u70b9\u51fb\u5728\"\u5355\u51fb\u6211\"\u6309\u94ae\u4e0a\uff0c\u60a8\u5c06\u770b\u5230\u5f39\u51fa\u6846\u5904\u4e8e\u6253\u5f00\u72b6\u6001\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c12\u5f20 <\/p>\n

\n \u73b0\u5728\uff0c\u5355\u51fb\"\u786e\u5b9a\"\u6309\u94ae\uff0c\u60a8\u5c06\u770b\u5230\u6307\u5b9a\u7684URL\u4e0d\u518d\u6253\u5f00\u3002\n <\/div>\n

Vue.js\u4e8b\u4ef6\u952e\u4fee\u9970\u7b26<\/h3>\n
\n \u5728Vue.js\u4e2d\uff0c\u952e\u4fee\u9970\u7b26\u7528\u4e8e\u5904\u7406\u548c\u63a7\u5236\u4e8b\u4ef6\u5904\u7406\u3002\u5728\u76d1\u542c\u952e\u76d8\u4e8b\u4ef6\u65f6\uff0c\u6211\u4eec\u9700\u8981\u68c0\u67e5\u7279\u5b9a\u7684\u952e\u3002 Vue.js\u63d0\u4f9b\u4e86\u4e00\u79cd\u5728\u4fa6\u542c\u6309\u952e\u4e8b\u4ef6\u65f6\u4e3av-on\u6dfb\u52a0\u6309\u952e\u4fee\u9970\u7b26\u7684\u65b9\u6cd5\u3002\n <\/div>\n
\n \u4f8b\u5982\uff0c\u5047\u8bbe\u60a8\u6709\u4e00\u4e2a\u6587\u672c\u6846\uff0c\u5e76\u4e14\u53ea\u60f3\u5728\u6309\u4e0bEnter\u952e\u65f6\u624d\u8c03\u7528\u8be5\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5411\u4e8b\u4ef6\u6dfb\u52a0\u952e\u4fee\u9970\u7b26\u6765\u5b9e\u73b0\u6b64\u76ee\u7684\uff0c\u5982\u4e0b\u6240\u793a\u3002\n <\/div>\n
\n \u8bed\u6cd5: <\/strong>\n <\/div>\n
\n
 <input type = \"text\" v-on: event_name.key_name= \"showinputvalue\"\/> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u793a\u4f8b<\/strong>: \u5982\u679c\u8981\u5bf9\u4e8b\u4ef6\u5e94\u7528\u952e\u76d8\u8f93\u5165\u5e76\u8f93\u5165\u6309\u94ae\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u5b9e\u73b0:\n <\/div>\n
\n
 <input type = \"text\" v-on:keyup.enter = \"showinputvalue\"\/> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6ce8\u610f: <\/span>\u60a8\u8fd8\u53ef\u4ee5\u5728\u4e8b\u4ef6\u4e2d\u4f7f\u7528\u591a\u4e2a\u952e\u540d\u3002\u4f8b\u5982: \u8ba9\u6211\u4eec\u4f7f\u7528keyup\uff0cctrl\uff0c\u7136\u540e\u8f93\u5165\u5bc6\u94a5\u540d\u3002\n <\/div>\n
\n
 <input type = \"text\" v-on.keyup.ctrl.enter= \"showinputvalue\"\/> 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u793a\u4f8b\uff0c\u4ee5\u6f14\u793aVue.js\u4e8b\u4ef6\u7684\u5173\u952e\u4fee\u9970\u7b26\u5e76\u5f88\u597d\u5730\u7406\u89e3\u5b83\u3002\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
     <div id = \"key_1\">
         <input type = \"text\" v-on:keyup.enter = \"showinputvalue\" v-bind:style = \"styleobj\" placeholder = \"Type your name here..\"\/>
         <h3><\/span> {{name}}<\/h3><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 var vm = new Vue({
            el: '#key_1',
            data: {
               name:'',
               styleobj: {
                  width: \"100%\",
                  padding: \"12px 20px\",
                  margin: \"8px 0\",
                  boxSizing: \"border-box\"
               }
            },
            methods : {
               showinputvalue : function(event) {
                  this.name=event.target.value;
               }
            }
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6267\u884c\u540e\u5728\u8be5\u7a0b\u5e8f\u4e2d\uff0c\u60a8\u4f1a\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c13\u5f20 <\/p>\n

\n \u5728\u6587\u672c\u6846\u4e2d\u5199\u4e00\u4e9b\u4e1c\u897f\uff0c\u7136\u540e\u67e5\u770b\u7ed3\u679c\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c14\u5f20 <\/p>\n

\n \u5728\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\uff0c\u5373\u4f7f\u5728\u6587\u672c\u6846\u4e2d\u952e\u5165\u540d\u79f0\u540e\uff0c\u8be5\u540d\u79f0\u4e5f\u4e0d\u4f1a\u51fa\u73b0\u5728\u7ed3\u679c\u4e2d\u3002\u73b0\u5728\uff0c\u6309\u8f93\u5165\u6309\u94ae\uff0c\u5c06\u663e\u793a\u540d\u79f0\u3002\u8bf7\u53c2\u89c1\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c15\u5f20 <\/p>\n

\n \u60a8\u53ef\u4ee5\u5728\u60a8\u7684\u952e\u76d8\u4e0a\u4f7f\u7528\u4ee5\u4e0b\u5173\u952e\u4fee\u9970\u7b26\u4e8b\u4ef6\u3002\n <\/div>\n

.enter <\/span>
\n .tab <\/span>
\n .delete(\u5b83\u540c\u65f6\u8bfb\u53d6\" Delete\"\u548c\" Backspace\"\u952e)<\/span>
\n .esc <\/span>
\n .space <\/span>
\n .up <\/span>
\n .down <\/span>
\n .left <\/span>
\n .right <\/span> <\/p>\n

Vue.js\u81ea\u5b9a\u4e49\u4e8b\u4ef6<\/h3>\n
\n \u5f53\u6211\u4eec\u9700\u8981\u544a\u8bc9\u7236\u7ea7\u6211\u4eec\u8981\u5728\u5b50\u7ea7\u7ec4\u4ef6\u4e2d\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u5c06\u4f7f\u7528\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u3002\u7236\u7ec4\u4ef6\u53ef\u4ee5\u4f7f\u7528prop\u5c5e\u6027\u5c06\u6570\u636e\u4f20\u9012\u5230\u5176\u7ec4\u4ef6\u3002\n <\/div>\n
\n \u7236\u7ec4\u4ef6\u53ef\u4ee5\u4f7f\u7528
\n v-on <\/strong>\u5c5e\u6027\u6765\u4fa6\u542c\u5b50\u7ec4\u4ef6\u4e8b\u4ef6\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u793a\u4f8b:\n <\/div>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Event Handling<\/title><\/span>
      <link rel=\"stylesheet\" href=\"index.css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
     <div id = \"eg_2\">
         <div id = \"custom-event-example\">
            <p style = \"font-size:25px;\">Language displayed : <b><\/span>{{ languageclicked }}<\/b><\/span><\/p><\/span>
            <button-counter
            v-for = \"(item, index) in languages\"
            v-bind:item = \"item\"
            v-bind:index = \"index\"
            v-on:showlanguage = \"languagedisp\">
            <\/button-counter>
         <\/div><\/span>
      <\/div><\/span>
      <script src=\"index.js\"><\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n Index.js\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 vue.component('button-counter', {
            template: '<button v-on:click = \"displayLanguage(item)\"><span style = \"font-size:25px;\">{{ item }}<\/span><\/span><\/button><\/span>',
            data: function () {
               return {
                  counter: 0
               }
            },
            props:['item'],
            methods: {
               displayLanguage: function (lng) {
                  console.log(lng);
                  this.$emit('showlanguage', lng);
               }
            },
         });
         var vm = new Vue({
            el: '#eg_2',
            data: {
               languageclicked: \"\",
               languages : [\"Java\", \"C\", \"C++\", \"Python\", \"Javascript\", \"Angular\", \"Data Structure\", \"jQuery\"]
            },
            methods: {
               languagedisp: function (a) {
                  this.languageclicked = a;
               }
            }
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7a0b\u5e8f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c16\u5f20 <\/p>\n

\n \u5982\u679c\u5355\u51fb\u4efb\u4f55\u6309\u94ae\uff0c\u5b83\u5c06\u663e\u793a\u5728\u8f93\u51fa\u4e2d\u3002\u8ba9\u6211\u4eec\u5355\u51fbPython\u6309\u94ae\u5e76\u67e5\u770b\u7ed3\u679c\u3002\n <\/div>\n

Vue.js \u4e8b\u4ef6_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c17\u5f20 <\/p>\n

\u793a\u4f8b\u8bf4\u660e<\/h3>\n
\n \u4e0a\u9762\u7684\u793a\u4f8b\u663e\u793a\u4e86\u7236\u7ec4\u4ef6\u548c\u5b50\u7ec4\u4ef6\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u3002\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u521b\u5efa\u7236\u7ec4\u4ef6\u3002\n <\/div>\n
\n
 <button-counter
   v-for = \"(item, index) in languages\"
   v-bind:item = \"item\"
   v-bind:index = \"index\"
   v-on:showlanguage = \"languagedisp\">
<\/button-counter>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5728\u8fd9\u91cc\uff0cv-for\u5c5e\u6027\u5c06\u4e0e\u5728\u5176\u4e2d\u5305\u542b\u8bed\u8a00\u5217\u8868\u7684languages\u6570\u7ec4\u4e00\u8d77\u5faa\u73af\u3002\u6211\u4eec\u5fc5\u987b\u5c06\u8be6\u7ec6\u4fe1\u606f\u53d1\u9001\u5230\u5b50\u7ec4\u4ef6\uff0c\u4ee5\u4fbf\u5c06\u6570\u7ec4\u7684\u503c\u5b58\u50a8\u5728\u9879\u76ee\u548c\u7d22\u5f15\u4e2d\u3002\n <\/div>\n
\n
 v-bind:item = \"item\"
v-bind:index = \"index\"
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8981\u4f7f\u7528\u6570\u7ec4\u7684\u503c\uff0c\u8bf7\u5148\u5c06\u5176\u7ed1\u5b9a\u5230\u53d8\u91cf\uff0c\u7136\u540e\u4f7f\u7528props\u5c5e\u6027\u5f15\u7528\u8be5\u53d8\u91cf:\n <\/div>\n
\n
 vue.component('button-counter', {
   template: '<button v-on:click = \"displayLanguage(item)\"><span style = \"font-size:25px;\">{{ item }}<\/span><\/span><\/button><\/span>',
   data: function () {
      return {
         counter: 0
      }
   },
   props:['item'],
   methods: {
      displayLanguage: function (lng) {
         console.log(lng);
         this.$emit('showlanguage', lng);
      }
   },
});
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4e8b\u4ef6\u7684\u540d\u79f0\u4e3a
\n showlanguage <\/strong>\uff0c\u5b83\u8c03\u7528\u4e00\u4e2a\u540d\u4e3a
\n languagedisp <\/strong>\u7684\u65b9\u6cd5\uff0c\u8be5\u65b9\u6cd5\u5df2\u5728Vue\u5b9e\u4f8b\u4e2d\u5b9a\u4e49\u3002\n <\/div>\n
\n \u5728\u7ec4\u4ef6\uff0c\u6a21\u677f\u5b9a\u4e49\u5982\u4e0b-\n <\/div>\n
\n
 template: '<button v-on:click = \"displayLanguage(item)\"><span style = \"font-size:25px;\">{{ item }}<\/span><\/span><\/button><\/span>',
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u65b9\u6cd5
\n displayLanguage <\/strong>\u7528\u4e8e\u8c03\u7528\u6b64\u51fd\u6570\u3002$ emit('showlanguage'\uff0clng);\n <\/div>\n
\n $ emit <\/strong>\u7528\u4e8e\u8c03\u7528\u7236\u7ec4\u4ef6\u65b9\u6cd5\u3002\u65b9\u6cd5
\n showlanguage <\/strong>\u662f\u4f7f\u7528
\n v-on <\/strong>\u5728\u7ec4\u4ef6\u4e0a\u7ed9\u51fa\u7684\u4e8b\u4ef6\u540d\u79f0\u3002\n <\/div>\n
\n \u73b0\u5728\uff0c\u6211\u4eec\u4f20\u9012\u4e86\u4e00\u4e2a\u53c2\u6570\u3002\u4f20\u9012\u7684\u53c2\u6570\u662f\u5355\u51fb\u5230\u4e3b\u7236Vue\u5b9e\u4f8b\u7684\u65b9\u6cd5\u7684\u8bed\u8a00\u7684\u540d\u79f0\u3002\u5b9a\u4e49\u5982\u4e0b:\n <\/div>\n
\n
 var vm = new Vue({
   el: '#databinding',
   data: {
      languageclicked: \"\",
      languages : [\"Java\", \"C\", \"C++\", \"Python\", \"Javascript\", \"Angular\", \"Data Structure\", \"jQuery\"]
   },
   methods: {
      languagedisp: function (a) {
         this.languageclicked = a;
      }
   }
})
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Vue.js \u4e8b\u4ef6zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[122],"tags":[],"class_list":["post-978","post","type-post","status-publish","format-standard","hentry","category-vuejc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/978"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=978"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/978\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}