index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <QStemplate :title="title" :titleHide="titleHide" :fontSize="fontSize" :width="width" :titleFlex="titleFlex"
  3. :contentFlex="contentFlex" :titleStyle="titleStyle" :contentStyle="contentStyle" :required="required" :requiredSign="requiredSign"
  4. :layout="layout" :titleLayout="titleLayout" :itemDisabled="itemDisabled" :titleColor="titleColor">
  5. <view class="flex_row_none_c width100 padding_10rpx_15rpx" :class="itemLayout_computed">
  6. <switch :style="{'transform': 'scale(' + scale + ')'}" :checked="value" @change="change" :color="color" :disabled="disabled" />
  7. </view>
  8. </QStemplate>
  9. </template>
  10. <script>
  11. import _app from '../../js/app.js';
  12. import QStemplate from '../../template/template.vue';
  13. import QSInputsMixin from '../../js/QSInputsMixin.js';
  14. export default {
  15. components: {
  16. QStemplate
  17. },
  18. props: {
  19. color: {
  20. type: String,
  21. default: ''
  22. },
  23. scale: {
  24. type: [String, Number],
  25. default: '.8'
  26. },
  27. disabled: {
  28. type: Boolean,
  29. default: false
  30. }
  31. },
  32. methods: {
  33. change({
  34. detail: {
  35. value
  36. }
  37. }) {
  38. this.setValue(value);
  39. }
  40. },
  41. mixins: [QSInputsMixin({
  42. QSInputsType: _app.typeObj.switch
  43. })]
  44. };
  45. </script>
  46. <style scoped>
  47. @import url("../../css/inputs.css");
  48. </style>