瀏覽代碼

上传文件至 '微信小程序/douban/components/itemview'

13395952019 5 年之前
父節點
當前提交
56b5fdf585

+ 30 - 0
微信小程序/douban/components/itemview/itemview.js

@@ -0,0 +1,30 @@
+// components/itemview/itemview.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    item:{
+      type:Object,
+      value:{}
+    },
+    itemurl:{
+      type:String,
+      value:""
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 6 - 0
微信小程序/douban/components/itemview/itemview.json

@@ -0,0 +1,6 @@
+{
+  "component": true,
+  "usingComponents": {
+    "stars": "/components/stars/stars"
+  }
+}

+ 11 - 0
微信小程序/douban/components/itemview/itemview.wxml

@@ -0,0 +1,11 @@
+<navigator wx:if="{{item}}" class='item-navigator' url='{{itemurl}}'>
+  <view class='item-group'>
+    <view class='thumbnail-group'>
+      <image class='thumbnail' src='{{item.cover.url}}'></image>
+      <view class='item-title'>{{item.title}}</view>
+      <stars rate="{{item.rating.value}}"></stars>
+    </view>
+  </view>
+</navigator>
+
+<navigator wx:else class='item-navigator'></navigator>

+ 26 - 0
微信小程序/douban/components/itemview/itemview.wxss

@@ -0,0 +1,26 @@
+.item-navigator{
+  width: 200rpx;
+  margin-right: 20rpx;
+  display: inline-block;
+}
+
+.item-navigator .item-group{
+  width: 100%;
+}
+.item-group .thumbnail-group{
+  width: 100%;
+  height: 284rpx;
+}
+.thumbnail-group .thumbnail{
+  width: 100%;
+  height: 100%;
+}
+
+.item-group .item-title{
+  font-size: 28rpx;
+  text-align: center;
+  margin-top: 20rpx;
+  text-overflow: ellipsis;/*设置超出问涨缩写显示*/
+  overflow: hidden;
+  margin-bottom: 20rpx;
+}