| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <div class="custom-component" :style="{
- width,
- height
- }">
- <span>
- 宽:<el-input v-model="dataModel.width" :disabled="disabled" style="width: 200px;"></el-input>
- </span>
- <span>
- 高:<el-input v-model="dataModel.height" :disabled="disabled" style="width: 200px;"></el-input>
- </span>
- <div>{{tip}}</div>
- </div>
- </template>
- <script>
- export default {
- name: 'custom-width-height',
- props: {
- value: {
- type: Object,
- default: () => ({})
- },
- width: {
- type: String,
- default: ''
- },
- height: {
- type: String,
- default: ''
- },
- disabled: {
- type: Boolean,
- default: false
- },
- tip: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- dataModel: this.value
- }
- },
- mounted () {
- this.$emit('on-test', 'abc', '111')
- },
- watch: {
- value (val) {
- this.dataModel = val
- },
- dataModel (val) {
- this.$emit('input', val)
- }
- }
- }
- </script>
- <style lang="scss">
- .custom-component{
- background: #eee;
- padding: 10px;
- span{
- +span{
- margin-left: 10px;
- }
- }
- }
- </style>
|