美文网首页
2018-08-01 vue.js学习实践(二)

2018-08-01 vue.js学习实践(二)

作者: 幸福晓杰2016 | 来源:发表于2018-08-03 11:40 被阅读21次

1.错误:The template root requires exactly one element.
大概的意思是:组件模板应该包含一个根元素。
即,必须一个根元素,而不能是并列的元素排列的,参考

 var childComponent = Vue.extend({
        template: '<div>this is child template</div>'
    });
    Vue.component("parent",{
        template: '<div>this is parent template</div><child></child>',
//正确代码
// template: '<p>this is parent template<child></child></p>'
    components: {
            'child': childComponent,
        }
    });
    var app = new Vue({
        el: '#app'
    });

2.注意区分:
padding: 上,右,下,左, 内部间距

3.line-height 表示的是行间距
配合font-size 能够实现一段文字的居中

相关文章

网友评论

      本文标题:2018-08-01 vue.js学习实践(二)

      本文链接:https://www.haomeiwen.com/subject/xusrvftx.html