<template>
    <el-dialog title="设置文字" :visible.sync="runningModal" width="700px">
        <el-form :model="form">
            <el-form-item label="输入文字" :label-width="formLabelWidth">
                <el-input v-model="form.fontcontent" placeholder="请输入文字"></el-input>
            </el-form-item>

            <el-form-item label="文字字号" :label-width="formLabelWidth">
                <el-input-number v-model="form.fontsize" controls-position="right" @change="handleChange" :min="12" :max="30"></el-input-number>
            </el-form-item>

            <el-form-item label="移动速度" :label-width="formLabelWidth">
                <el-input-number v-model="form.speed" controls-position="right" @change="handleChange2" :min="1" :max="100"></el-input-number>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="runningModal = false">取 消</el-button>
            <el-button type="primary" @click="runningModal = false">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import PubSub from 'pubsub-js'

    export default {
        data() {
            return {
                runningModal:false,
                form: {
                    fontcontent:'',
                    fontsize:12,
                    speed:1
                },
                formLabelWidth: '150px'
            }
        },
        mounted() {
            PubSub.subscribe('running',(msg,data) => {
                this.runningModal = true
            })
        },
        methods: {
            handleChange(value) {
                this.form.fontsize = value
            },
            handleChange2(value) {
                this.form.speed = value
            },
        }
    }
</script>

<style scoped>

</style>
