<template> <view class="center" style="margin: 5rpx;"> <view :class="statusStyle(status)"> • <text v-if="showDesc" > {{statusDesc(status)}} </text> </view> </view> </template> <script> import { getInventoryStatusStyle, getInventoryStatusName } from '@/common/directory.js'; export default { data() { return { }; }, // 此处定义传入的数据 props: { status: { type: String, default: "1" }, showDesc: { type: Boolean, default: false }, }, methods: { statusStyle: function(val) { return getInventoryStatusStyle(val); }, statusDesc(value) { return getInventoryStatusName(value) } } } </script> <style lang="scss"> </style> <style> </style>