index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="u-demo">
  3. <view class="u-demo-wrap">
  4. <view class="u-demo-title">演示效果</view>
  5. <view class="u-demo-area">
  6. <view class="u-no-demo-here" style="text-align: left;">
  7. 此处演示为通过JS调用框架内置颜色值,此外还可以通过scss变量调用。
  8. </view>
  9. <view class="u-demo-result-line" :style="{color: color, backgroundColor: '#ffffff'}">
  10. 晓镜但愁云鬓改,夜吟应觉月光寒
  11. </view>
  12. </view>
  13. </view>
  14. <view class="u-config-wrap">
  15. <view class="u-config-title u-border-bottom">
  16. 参数配置
  17. </view>
  18. <view class="u-config-item">
  19. <view class="u-item-title">主题</view>
  20. <u-subsection :list="['primary', 'success', 'error', 'warning', 'info']" @change="modeChange"></u-subsection>
  21. </view>
  22. <view class="u-config-item">
  23. <view class="u-item-title">常用颜色</view>
  24. <u-subsection :list="['主要文字', '常规文字', '次要文字', '占位文字', '边框颜色']" @change="colorChange"></u-subsection>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. color: this.$u.color['primary'],
  34. }
  35. },
  36. methods: {
  37. modeChange(index) {
  38. let colorName = index == 0 ? 'primary' : index == 1 ? 'success' : index == 2 ? 'error' : index == 3 ? 'warning' : 'info';
  39. this.color = this.$u.color[colorName];
  40. },
  41. colorChange(index) {
  42. this.color = index == 0 ? '#303133' : index == 1 ? '#606266' : index == 2 ? '#909399' : index == 3 ? '#c0c4cc' : '#e4e7ed';
  43. },
  44. getResult() {
  45. this.result = this.$u.trim(this.string, this.pos);
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .u-demo {}
  52. </style>