{"id":982,"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\u52a8\u753b","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/982.html","title":{"rendered":"Vue.js\u52a8\u753b"},"content":{"rendered":"


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

\n

Vue.js\u52a8\u753b<\/h1>\n<\/p><\/div>\n
\n \u5728Vue.js\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u7528\u4e0e\u5728\u5148\u524d\u793a\u4f8b\u4e2d\u5e94\u7528\u8fc7\u6e21\u76f8\u540c\u7684\u65b9\u5f0f\u6765\u5e94\u7528\u52a8\u753b\u3002\u52a8\u753b\u8fd8\u6709\u4e00\u4e9b\u7c7b\u5fc5\u987b\u58f0\u660e\u624d\u80fd\u83b7\u5f97\u52a8\u753b\u6548\u679c\u3002\n <\/div>\n
\n Vue.js\u8fc7\u6e21\u548cVue.js\u52a8\u753b\u4e4b\u95f4\u7684\u552f\u4e00\u533a\u522b\u662f\uff0c\u5728Vue.js\u52a8\u753b\u4e2d\uff0c\u4e0d\u4f1a\u5220\u9664v-enter\n <\/div>\n
\n \u8ba9\u6211\u4eec\u4ee5\u4e00\u4e2a\u4f8b\u5b50\u6765\u7406\u89e3\u52a8\u753b\u7684\u6982\u5ff5\uff0c\u5e76\u67e5\u770b\u52a8\u753b\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u5de5\u4f5c\u65b9\u5f0f\u3002\n <\/div>\n

\u793a\u4f8b<\/h3>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Animation<\/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>
    <style><\/span>
         .shiftx-enter-active {
            animation: shift-in 2s;
         }
         .shiftx-leave-active {
            animation: shift-in 2s reverse;
         }
         @keyframes shift-in {
            0% {transform:rotateX(0deg);}
            25% {transform:rotateX(90deg);}
            50% {transform:rotateX(120deg);}
            75% {transform:rotateX(180deg);}
            100% {transform:rotateX(360deg);}
         }
      <\/style><\/span>
      <div id = \"databinding\">
      <p><\/span> Click at the below button to see the animation effect.<\/p><\/span>
         <button v-on:click = \"show = !show\">Click Here<\/button><\/span>
         <transition name = \"shiftx\">
            <p v-show = \"show\">
               <img src = \"https:\/\/www.flowerpower.com.au\/media\/catalog\/product\/image\/287189f77f\/love-you-rose.jpg\" style = \"width:100px;height:100px;\" \/>
            <\/p><\/span>
         <\/transition>
      <\/div><\/span>
      <\/script><\/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: {
               show:true
            },
            methods : {
            }
         })
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8ba9\u6211\u4eec\u4f7f\u7528\u7b80\u5355\u7684
\n CSS \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\u52a8\u753b_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c1\u5f20 <\/p>\n

\n \u5f53\u60a8\u5355\u51fb\"\u5355\u51fb\u6b64\u5904\"\u6309\u94ae\u65f6\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u52a8\u753b\u6548\u679c\u3002\u56fe\u50cf\u5c06\u4ece0\u65cb\u8f6c\u5230360\u5ea6\uff0c\u6700\u540e\u6d88\u5931\u3002\u8bf7\u53c2\u89c1\u4ee5\u4e0b\u56fe\u50cf:\n <\/div>\n

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

\n \u53e6\u4e00\u4e2a\u5c4f\u5e55\u622a\u56fe: <\/strong>\n <\/div>\n

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

\u793a\u4f8b\u8bf4\u660e<\/h3>\n
\n \u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u4f7f\u7528\u4e86\u4e0e\u8fc7\u6e21\u6548\u679c\u76f8\u540c\u7684\u7c7b\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u56fe\u50cf\u5c01\u88c5\u5728p\u6807\u7b7e\u4e2d\uff0c\u5982\u4e0b\u6240\u793a:\n <\/div>\n
\n
 <transition name = \"shiftx\">
            <p v-show = \"show\">
               <img src = \"https:\/\/www.flowerpower.com.au\/media\/catalog\/product\/image\/287189f77f\/love-you-rose.jpg\" style = \"width:100px;height:100px;\" \/>
            <\/p><\/span>
         <\/transition>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5728\u8fd9\u91cc\uff0c\u8f6c\u6362\u7684\u540d\u79f0\u4e3a
\n shiftx <\/strong>\uff0c\u5e76\u4e14\u8be5\u7c7b\u5c06\u7528\u4f5c\u4ee5\u4e0bCSS\u4ee3\u7801:\n <\/div>\n
\n
 <style><\/span>
   .shiftx-enter-active {
      animation: shift-in 2s;
   }
   .shiftx-leave-active {
      animation: shift-in 2s reverse;
   }
   @keyframes shift-in {
      0% {transform:rotateX(0deg);}
      25% {transform:rotateX(90deg);}
      50% {transform:rotateX(120deg);}
      75% {transform:rotateX(180deg);}
      100% {transform:rotateX(360deg);}
   }
<\/style><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u8be5\u7c7b\u5728\u8fc7\u6e21\u540d\u79f0\u4e2d\u5b9a\u4e49\uff0c\u5373
\n shiftx-enter-active\u548c.shiftx-leave-active\u3002<\/strong>\n <\/div>\n
\n \u5df2\u5b9a\u4e49\u4e86\u52a8\u753b
\n \u5173\u952e\u5e27\u7684\u8303\u56f4\u4ece0\uff05\u5230100\uff05<\/strong>\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5173\u952e\u5e27\u7684\u53d8\u6362\u7a0b\u5ea6\u5b9a\u4e49\u5982\u4e0b:\n <\/div>\n
\n
    @keyframes shift-in {
      0% {transform:rotateX(0deg);}
      25% {transform:rotateX(90deg);}
      50% {transform:rotateX(120deg);}
      75% {transform:rotateX(180deg);}
      100% {transform:rotateX(360deg);}
   }
<\/span><\/code><\/pre>\n<\/p><\/div>\n

\u81ea\u5b9a\u4e49\u8fc7\u6e21\u7c7b<\/h3>\n
\n Vue.js \u53ef\u5e2e\u52a9\u60a8\u6307\u5b9a\u60a8\u53ef\u4ee5\u901a\u8fc7\u63d0\u4f9b\u4ee5\u4e0b\u5c5e\u6027\u6765\u5b9a\u5236\u81ea\u5df1\u7684\u81ea\u5b9a\u4e49\u8fc7\u6e21\u7c7b\u3002\u8fd9\u4e9b\u5c5e\u6027\u53ef\u4ee5\u6dfb\u52a0\u5230\u8fc7\u6e21\u5143\u7d20\u4e2d\u3002\n <\/div>\n

enter-class<\/span>
\n enter-active-class <\/span>
\n enter-to-class (added in version 2.1.8+)<\/span>
\n leave-class<\/span>
\n leave-active-class<\/span>
\n leave-to-class (added in version 2.1.8+)<\/span> <\/p>\n

\n \u81ea\u5b9a\u4e49\u7c7b\u901a\u5e38\u5728\u6211\u4eec\u60f3\u8981\u4f7f\u7528\u5916\u90e8CSS\u5e93(\u4f8b\u5982animate.css)\u65f6\u4f7f\u7528\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u4e3e\u4e00\u4e2a\u4f8b\u5b50\u6765\u4e86\u89e3\u81ea\u5b9a\u4e49\u8fc7\u6e21\u7c7b\u7684\u6982\u5ff5\u5e76\u4e86\u89e3\u5b83\u4eec\u5982\u4f55\n <\/div>\n

\u793a\u4f8b<\/h3>\n
\n Index.html\u6587\u4ef6: <\/strong>\n <\/div>\n
\n
 <html><\/span>
   <head><\/span>
      <title><\/span>Vue.js Animation<\/title><\/span>
      <link href = \"https:\/\/cdn.jsdelivr.net\/npm\/animate.css@3.5.1\" rel = \"stylesheet\" type = \"text\/css\">
        <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.js\"><\/script><\/span>
      <script type = \"text\/javascript\" src = \"js\/vue.js\"><\/script><\/span>
    <\/head><\/span>
    <body><\/span>
     <div id = \"animation\" style = \"text-align:center\">
         <button @click = \"show = !show\"><span style = \"font-size:25px;\">Click Here<\/span><\/span><\/button><\/span>
         <transition
            name = \"custom-classes-transition\"
            enter-active-class = \"animated swing\"
            leave-active-class = \"animated bounceIn\">
            <p v-if = \"show\"><span style = \"font-size:25px;\">See the animation effect<\/span><\/span><\/p><\/span>
         <\/transition>
      <\/div><\/span>
      <\/script><\/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: '#animation',
            data: {
               show: true
            }
         })
<\/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\u52a8\u753b_https:\/\/bianchenghao6.com_\u3010vue\u6559\u7a0b\u3011_\u7b2c4\u5f20 <\/p>\n

\n \u5f53\u60a8\u5355\u51fb\"\u5355\u51fb\u6b64\u5904\"\u6309\u94ae\u65f6\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u4e24\u79cd\u7c7b\u578b\u7684\u52a8\u753b\u3002\u5e94\u7528\u4e8e\u4e0a\u9762\u793a\u4f8b\u7684\u7b2c\u4e00\u4e2a\u52a8\u753b\u662f:\n <\/div>\n
\n
 enter-active-class = \"animated swing\" 
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

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

\n \u7b2c\u4e8c\u4e2a\u52a8\u753b\u662f: <\/strong>\n <\/div>\n
\n
 leave-active-class = \"animated bounceIn\"
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8f93\u51fa: <\/strong>\n <\/div>\n

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

\n \u6b64\u5904\uff0c\u6211\u4eec\u5df2\u7ecf\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93
\n animate.css <\/strong>\u6765\u5c55\u793a\u793a\u4f8b\u4e2d\u81ea\u5b9a\u4e49\u52a8\u753b\u7c7b\u7684\u4f7f\u7528\u3002\n <\/div>\n
\n
 <link href = \"https:\/\/cdn.jsdelivr.net\/npm\/animate.css@3.5.1\" rel = \"stylesheet\" type = \"text\/css\">
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Vue.js\u52a8\u753bzh-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-982","post","type-post","status-publish","format-standard","hentry","category-vuejc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/982"}],"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=982"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/982\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}