组件 empty.vue
- bug: props默认值为default
- bug:动态style :style="{marginTop:top+‘rpx’}" ,marginTop 要大写
- bug:动态style :style="{width:width+‘rpx’,height:height+‘rpx’}" 单位后边不能加;
<template>
<view class='null text-center u-p-b-50' :style="{marginTop:top+'rpx'}">
<image src="../static/null.png" :style="{width:width+'rpx',height:height+'rpx'}" mode=""></image>
<view class="u-font-30 text-center u-m-t-30">{{text}}</view>
</view>
</template>
<script>
export default {
props:{
top:{
type:String,
default: '370'
},
text:{
type:String,
default:'暂无数据'
},
width:{
type:String,
default:'400'
},
height:{
type:String,
default:'310'
}
},
data() {
return {
}
},
onLoad() {
},
methods: {
},
}
</script>
<style scoped lang='scss'>
</style>
main.js引入
import empty from './components/empty.vue'
Vue.component('empty',empty)
页面使用
<empty v-if="list.length==0" top="100" text="暂无委托记录"></empty>