zoukankan      html  css  js  c++  java
  • vue 中的小知识点

    1)使用is解决小bug

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js"></script>
      </head>
      <body>
        <div id="root">
          <table>
            <tbody>
              <tr is="row"></tr>
              <tr is="row"></tr>
            </tbody>
          </table>

        </div>

        <script>
        Vue.component('row',{
          template:'<tr><td>{{content}}</td></tr>',
          data(){
            return{
              content:'this is row'
            }

          }
        })
        var vm = new Vue({
          el:'#root'
        })
        </script>
      </body>
    </html>

    2)给组件绑定原生事件

    <body>
    	<div id="root">
    		<child @click.native="handleClick"></child>
    	</div>
    
    	<script type="text/javascript">
    		Vue.component('child',{
    			template:"<div>child</div>"
    		})
    
    		var vm= new Vue({
    			el:"#root",
    			methods:{
    				handleClick:function(){
    					alert("click")
    				}
    			}
    		})
    	</script>
    </body>
    

      

  • 相关阅读:
    重新格式化部门表
    从不订购的客户
    回文数
    shell中的双括号表达式
    shell中的if语句
    shell
    view的生命周期
    shell中的数学运算
    shell中的expr命令
    shell中的退出状态码
  • 原文地址:https://www.cnblogs.com/xuwupiaomiao/p/12070830.html
Copyright © 2011-2022 走看看