123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <div class="app-deploy-control-key">
- <el-input
- v-if="keyType === 'string'"
- v-model.trim="data"
- style="width: 100%"
- placeholder="请输入内容"
- clearable
- @change="dataChange"
- ></el-input>
- <el-input
- v-if="keyType === 'number'"
- v-model.number="data"
- type="number"
- style="width: 140px"
- :controls="false"
- placeholder="请输入数字"
- @change="dataChange"
- ></el-input>
- <el-radio-group
- v-if="keyType === 'boolean'"
- v-model="data"
- @change="dataChange"
- >
- <el-radio :label="null">无</el-radio>
- <el-radio :label="true">是</el-radio>
- <el-radio :label="false">否</el-radio>
- </el-radio-group>
- <el-date-picker
- v-if="keyType === 'time'"
- v-model="data"
- type="datetime"
- style="width: 100%"
- value-format="timestamp"
- placeholder="选择日期时间"
- clearable
- @change="dataChange"
- >
- </el-date-picker>
- </div>
- </template>
- <script>
- export default {
- name: "app-deploy-control-key",
- props: {
- value: { type: [Number, String, Boolean] },
- keyType: {
- type: String,
- default: "number",
- validator: (val) => ["number", "time", "string", "boolean"].includes(val),
- },
- },
- watch: {
- value: {
- immediate: true,
- handler(val) {
- this.data = val;
- },
- },
- },
- data() {
- return {
- data: null,
- };
- },
- methods: {
- dataChange() {
- // console.log(this.data);
- this.$emit("input", this.data);
- this.$emit("change", this.data);
- },
- },
- };
- </script>
|