jmash-diy-mp 0.1.3 → 0.1.4

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.4",
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
+ <!-- 标题(style=0:原有左侧竖线,style=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 === '0' }}" class="main-left-image"
7
+ src="{{ resourceUrl + 'images/icon_image/rectangle2x_' + themeColor + '.png' }}" mode="aspectFit" />
8
+ <image wx:if="{{ titleStyle === '1' }}" class="title-left-icon" src="{{ resourceUrl + titleImage }}"
9
+ 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,28 +50,30 @@ 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
+ // 样式(0:原有左侧竖线,1:自定义图标两侧)
60
+ let titleStyle = ref(props.compModel?.compData?.titleStyle ?? "0");
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 ?? "0";
72
+ });
73
+ // 监听 titleImage 变化
74
+ watch(() => props.compModel?.compData?.titleImage, (newVal) => {
75
+ titleImage.value = newVal ?? "";
76
+ });
78
77
 
79
78
  return {
80
79
  resourceUrl,
@@ -121,9 +120,6 @@ createComponent({
121
120
  }
122
121
 
123
122
  .main-right {
124
- display: flex;
125
- align-items: center;
126
- gap: 10rpx;
127
123
  height: 80rpx;
128
124
  color: #999999;
129
125
  font-size: 24rpx;
@@ -131,6 +127,11 @@ createComponent({
131
127
  line-height: 80rpx;
132
128
  }
133
129
  }
130
+
131
+ .title-left-icon {
132
+ width: 36rpx;
133
+ height: 41rpx;
134
+ }
134
135
  </style>
135
136
 
136
137
  <script type="application/json">