2. 封装vdiv组件,常用样式参数化传递
优点: 基本满足盒子模型需求,基本页面快速布局。
<template> <div :style="ssp"> textasasdasdas {{ss}} </div> </template> <script> export default { name: 'HelloWorld', props:['ss'], data () { return { msg: 'Welcome to Your Vue.js App', firstName:'ou', lastName:'wen' } }, methods:{ }, computed:{ ssp: function(){ return `padding-left:200px;` } } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> h1, h2 { font-weight: normal; } ul { list-style-type: none; padding: 0; } li { display: inline-block; margin: 0 10px; } a { color: #42b983; } </style>