jmash-diy-mp 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-diy-mp",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,19 +1,16 @@
1
1
  <template>
2
2
  <view class="basic-title-main">
3
- <!-- 标题 -->
3
+ <!-- 标题(titleStyle=0:原有左侧竖线,titleStyle=1:左侧自定义图标) -->
4
4
  <view class="main-left">
5
5
  <!-- 标题前面竖线 -->
6
- <image wx:if="{{ !leftIcon }}" class="main-left-image"
7
- src="{{ resourceUrl + 'rectangle2x_' + themeColor + '.png' }}" mode="aspectFit" />
8
- <slot wx:else name="leftIcon"></slot>
6
+ <image wx:if="{{ titleStyle === '1' }}" class="title-left-icon" src="{{ resourceUrl + titleImage }}"
7
+ mode="aspectFit" />
8
+ <image wx:else class="main-left-image"
9
+ src="{{ resourceUrl + 'images/icon_image/rectangle2x_' + themeColor + '.png' }}" mode="aspectFit" />
9
10
  {{ title }}
10
11
  </view>
11
12
  <!-- 查看更多 -->
12
- <view class="main-right" wx:if="{{ showMore }}" bind:tap="handleClickMore">
13
- <view>查看更多</view>
14
- <view wx:if="{{ !rightIcon }}">></view>
15
- <slot wx:else name="rightIcon"></slot>
16
- </view>
13
+ <view class="main-right" wx:if="{{ showMore }}" bind:tap="handleClickMore">查看更多 ></view>
17
14
  </view>
18
15
  </template>
19
16
 
@@ -53,32 +50,36 @@ createComponent({
53
50
  type: Boolean,
54
51
  value: false
55
52
  },
56
- // 是否自定义左侧图标
57
- leftIcon: {
58
- type: Boolean,
59
- default: false
60
- },
61
- // 是否自定义右侧图标
62
- rightIcon: {
63
- type: Boolean,
64
- default: false
65
- },
66
53
  },
67
54
  setup(props) {
68
55
  // 资源路径
69
- let resourceUrl = config.resourceUrl + "/images/icon_image/";
56
+ let resourceUrl = config.resourceUrl + '/';
70
57
  // 主题色
71
58
  let themeColor = ref(props.pageModel.pageData.theme);
59
+ // 标题样式(titleStyle=0:原有左侧竖线,1:左侧自定义图标)
60
+ let titleStyle = ref(props.compModel?.compData?.titleStyle);
61
+ // 标题图标
62
+ let titleImage = ref(props.compModel?.compData?.titleImage ?? "");
72
63
 
73
64
  // 主题变化
74
65
  const { pageModel } = toRefs(props)
75
66
  watch(pageModel, (newVal) => {
76
67
  themeColor.value = newVal.pageData.theme;
77
- })
68
+ });
69
+ // 监听 titleStyle 变化
70
+ watch(() => props.compModel?.compData?.titleStyle, (newVal) => {
71
+ titleStyle.value = newVal;
72
+ });
73
+ // 监听 titleImage 变化
74
+ watch(() => props.compModel?.compData?.titleImage, (newVal) => {
75
+ titleImage.value = newVal ?? "";
76
+ });
78
77
 
79
78
  return {
80
79
  resourceUrl,
81
80
  themeColor,
81
+ titleStyle,
82
+ titleImage,
82
83
  }
83
84
  },
84
85
  methods: {
@@ -121,9 +122,6 @@ createComponent({
121
122
  }
122
123
 
123
124
  .main-right {
124
- display: flex;
125
- align-items: center;
126
- gap: 10rpx;
127
125
  height: 80rpx;
128
126
  color: #999999;
129
127
  font-size: 24rpx;
@@ -131,6 +129,11 @@ createComponent({
131
129
  line-height: 80rpx;
132
130
  }
133
131
  }
132
+
133
+ .title-left-icon {
134
+ width: 36rpx;
135
+ height: 41rpx;
136
+ }
134
137
  </style>
135
138
 
136
139
  <script type="application/json">