郑柏铃 1 dienu atpakaļ
vecāks
revīzija
ce58e308c7

+ 2 - 0
18.uniapp小程序/project1/main.js

@@ -1,4 +1,6 @@
 import App from './App'
+import {newRequest} from 'utils/request.js';
+Vue.prototype.$newRequest = newRequest;
 
 // #ifndef VUE3
 import Vue from 'vue'

+ 4 - 2
18.uniapp小程序/project1/pages.json

@@ -9,7 +9,9 @@
 		{
 			"path": "pages/list/list",
 			"style": {
-				"navigationBarTitleText": "列表"
+				"navigationBarTitleText": "列表",
+				"enablePullDownRefresh": true,
+				"onReachBottomDistance": 0
 			}
 		}
 	],
@@ -19,7 +21,7 @@
 		"navigationBarBackgroundColor": "#ff0000",
 		// 下拉时窗口显示的背景色
 		"backgroundColor": "#007aff",
-		"enablePullDownRefresh": true,
+		// "enablePullDownRefresh": true,
 		"backgroundTextStyle": "dark",
 		// "onReachBottomDistance": ${1:0}
 	},

+ 14 - 1
18.uniapp小程序/project1/pages/home/home.vue

@@ -11,11 +11,24 @@
 		  <text space="nbsp">今    三</text>
 		  <h2>你好</h2>
 		  <text space="ensp">今               三</text>
-		  
+		  <button @click="getList">获取列表信息</button>
 	</view>
 </template>
 
 <script>
+	export default {
+		methods:{
+			getList() {
+				
+				const result = this.$newRequest({
+					url:'/rexxar/api/v2/subject_collection/tv_domestic/items?start=0&count=8',
+					method:"GET"
+				})
+				console.log(result);
+
+			}
+		}
+	}
 </script>
 
 <style scoped lang="scss">

+ 41 - 10
18.uniapp小程序/project1/pages/list/list.vue

@@ -1,11 +1,42 @@
-<template>
-	<view class="list">
-		list
-	</view>
-</template>
-
-<script>
-</script>
-
-<style>
+<template>
+	<view class="list">
+		{{list}}
+		<view v-for="(item,index) in list" :key="index">
+			<view class="box-item">
+				{{item}}
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				list: ['星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二',
+					'星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二', '星期一', '星期二',
+				]
+
+			}
+		},
+
+		onPullDownRefresh() {
+			console.log(("下拉中"))
+			setTimeout(() => {
+				uni.stopPullDownRefresh()
+			}, 2000)
+		},
+		onReachBottom() {
+			console.log("触底")
+			let arr = ['孙悟空','猪八戒','沙和尚']
+			this.list = [...this.list,...arr]
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.box-item {
+		height: 50rpx;
+		line-height: 50rpx;
+	}
 </style>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
18.uniapp小程序/project1/unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


+ 1 - 1
18.uniapp小程序/project1/unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/home.js.map

@@ -1 +1 @@
-{"version":3,"file":"home.js","sources":["pages/home/home.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Applications/学习/班级/w1020/18.uniapp小程序/project1/pages/home/home.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;AACA,GAAG,WAAW,eAAe;"}
+{"version":3,"file":"home.js","sources":["pages/home/home.vue","pages/home/home.vue?type=page"],"sourcesContent":["<template>\n\t<view class=\"home\">\n\t\t首页\n\t\t<view class=\"box\"></view>\n\t\t  <icon type=\"success\" size=\"26\"/>\n\t\t  <icon type=\"clear\" size=\"26\"/>\n\t\t  <icon type=\"search\" size=\"26\"/>\n\t\t  <h1 class=\"h1\">你好</h1>\n\t\t  <text space='emsp'>今        三</text>\n\t\t  <h2>你好</h2>\n\t\t  <text space=\"nbsp\">今    三</text>\n\t\t  <h2>你好</h2>\n\t\t  <text space=\"ensp\">今               三</text>\n\t\t  <button @click=\"getList\">获取列表信息</button>\n\t</view>\n</template>\n\n<script>\n\texport default {\n\t\tmethods:{\n\t\t\tgetList() {\n\t\t\t\tuni.request({\n\t\t\t\t    url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_domestic/items?start=0&count=8', //仅为示例,并非真实接口地址。\n\t\t\t\t    header: {\n\t\t\t\t        'custom-header': 'hello' //自定义请求头信息\n\t\t\t\t    },\n\t\t\t\t\tmethod:'GET',\n\t\t\t\t    success: (res) => {\n\t\t\t\t        console.log(res.data);\n\t\t\t\t        // this.text = 'request success';\n\t\t\t\t    }\n\t\t\t\t});\n\n\t\t\t}\n\t\t}\n\t}\n</script>\n\n<style scoped lang=\"scss\">\n\t@import url(\"../../test.css\");\n\ttext {\n\t\tcolor: $uni-color-primary;\n\t}\n\t.box {\n\t\twidth: 300rpx;\n\t\theight: 300rpx;\n\t\tbackground: #00f;\n\t}\n</style>","import MiniProgramPage from '/Applications/学习/班级/w1020/18.uniapp小程序/project1/pages/home/home.vue'\nwx.createPage(MiniProgramPage)"],"names":["uni"],"mappings":";;AAkBC,MAAK,YAAU;AAAA,EACd,SAAQ;AAAA,IACP,UAAU;AACTA,oBAAAA,MAAI,QAAQ;AAAA,QACR,KAAK;AAAA;AAAA,QACL,QAAQ;AAAA,UACJ,iBAAiB;AAAA;AAAA,QACpB;AAAA,QACJ,QAAO;AAAA,QACJ,SAAS,CAAC,QAAQ;AACdA,wBAAY,MAAA,MAAA,OAAA,6BAAA,IAAI,IAAI;AAAA,QAExB;AAAA,MACJ,CAAC;AAAA,IAEF;AAAA,EACD;AACD;;;;;;;AClCD,GAAG,WAAW,eAAe;"}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 1
18.uniapp小程序/project1/unpackage/dist/dev/.sourcemap/mp-weixin/pages/list/list.js.map


+ 0 - 1
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/app.json

@@ -8,7 +8,6 @@
     "navigationBarTitleText": "小程序",
     "navigationBarBackgroundColor": "#ff0000",
     "backgroundColor": "#007aff",
-    "enablePullDownRefresh": true,
     "backgroundTextStyle": "dark"
   },
   "tabBar": {

+ 166 - 3
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -88,6 +88,37 @@ const looseToNumber = (val) => {
   const n = parseFloat(val);
   return isNaN(n) ? val : n;
 };
+const toDisplayString = (val) => {
+  return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
+};
+const replacer = (_key, val) => {
+  if (val && val.__v_isRef) {
+    return replacer(_key, val.value);
+  } else if (isMap(val)) {
+    return {
+      [`Map(${val.size})`]: [...val.entries()].reduce(
+        (entries, [key, val2], i) => {
+          entries[stringifySymbol(key, i) + " =>"] = val2;
+          return entries;
+        },
+        {}
+      )
+    };
+  } else if (isSet(val)) {
+    return {
+      [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
+    };
+  } else if (isSymbol(val)) {
+    return stringifySymbol(val);
+  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
+    return String(val);
+  }
+  return val;
+};
+const stringifySymbol = (v, i = "") => {
+  var _a;
+  return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
+};
 const LOCALE_ZH_HANS = "zh-Hans";
 const LOCALE_ZH_HANT = "zh-Hant";
 const LOCALE_EN = "en";
@@ -4931,6 +4962,135 @@ function getCreateApp() {
     return my[method];
   }
 }
+function vOn(value, key) {
+  const instance = getCurrentInstance();
+  const ctx = instance.ctx;
+  const extraKey = typeof key !== "undefined" && (ctx.$mpPlatform === "mp-weixin" || ctx.$mpPlatform === "mp-qq" || ctx.$mpPlatform === "mp-xhs") && (isString(key) || typeof key === "number") ? "_" + key : "";
+  const name = "e" + instance.$ei++ + extraKey;
+  const mpInstance = ctx.$scope;
+  if (!value) {
+    delete mpInstance[name];
+    return name;
+  }
+  const existingInvoker = mpInstance[name];
+  if (existingInvoker) {
+    existingInvoker.value = value;
+  } else {
+    mpInstance[name] = createInvoker(value, instance);
+  }
+  return name;
+}
+function createInvoker(initialValue, instance) {
+  const invoker = (e2) => {
+    patchMPEvent(e2);
+    let args = [e2];
+    if (instance && instance.ctx.$getTriggerEventDetail) {
+      if (typeof e2.detail === "number") {
+        e2.detail = instance.ctx.$getTriggerEventDetail(e2.detail);
+      }
+    }
+    if (e2.detail && e2.detail.__args__) {
+      args = e2.detail.__args__;
+    }
+    const eventValue = invoker.value;
+    const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, eventValue), instance, 5, args);
+    const eventTarget = e2.target;
+    const eventSync = eventTarget ? eventTarget.dataset ? String(eventTarget.dataset.eventsync) === "true" : false : false;
+    if (bubbles.includes(e2.type) && !eventSync) {
+      setTimeout(invoke);
+    } else {
+      const res = invoke();
+      if (e2.type === "input" && (isArray(res) || isPromise(res))) {
+        return;
+      }
+      return res;
+    }
+  };
+  invoker.value = initialValue;
+  return invoker;
+}
+const bubbles = [
+  // touch事件暂不做延迟,否则在 Android 上会影响性能,比如一些拖拽跟手手势等
+  // 'touchstart',
+  // 'touchmove',
+  // 'touchcancel',
+  // 'touchend',
+  "tap",
+  "longpress",
+  "longtap",
+  "transitionend",
+  "animationstart",
+  "animationiteration",
+  "animationend",
+  "touchforcechange"
+];
+function patchMPEvent(event, instance) {
+  if (event.type && event.target) {
+    event.preventDefault = NOOP;
+    event.stopPropagation = NOOP;
+    event.stopImmediatePropagation = NOOP;
+    if (!hasOwn(event, "detail")) {
+      event.detail = {};
+    }
+    if (hasOwn(event, "markerId")) {
+      event.detail = typeof event.detail === "object" ? event.detail : {};
+      event.detail.markerId = event.markerId;
+    }
+    if (isPlainObject(event.detail) && hasOwn(event.detail, "checked") && !hasOwn(event.detail, "value")) {
+      event.detail.value = event.detail.checked;
+    }
+    if (isPlainObject(event.detail)) {
+      event.target = extend({}, event.target, event.detail);
+    }
+  }
+}
+function patchStopImmediatePropagation(e2, value) {
+  if (isArray(value)) {
+    const originalStop = e2.stopImmediatePropagation;
+    e2.stopImmediatePropagation = () => {
+      originalStop && originalStop.call(e2);
+      e2._stopped = true;
+    };
+    return value.map((fn) => (e3) => !e3._stopped && fn(e3));
+  } else {
+    return value;
+  }
+}
+function vFor(source, renderItem) {
+  let ret;
+  if (isArray(source) || isString(source)) {
+    ret = new Array(source.length);
+    for (let i = 0, l = source.length; i < l; i++) {
+      ret[i] = renderItem(source[i], i, i);
+    }
+  } else if (typeof source === "number") {
+    if (!Number.isInteger(source)) {
+      warn(`The v-for range expect an integer value but got ${source}.`);
+      return [];
+    }
+    ret = new Array(source);
+    for (let i = 0; i < source; i++) {
+      ret[i] = renderItem(i + 1, i, i);
+    }
+  } else if (isObject(source)) {
+    if (source[Symbol.iterator]) {
+      ret = Array.from(source, (item, i) => renderItem(item, i, i));
+    } else {
+      const keys = Object.keys(source);
+      ret = new Array(keys.length);
+      for (let i = 0, l = keys.length; i < l; i++) {
+        const key = keys[i];
+        ret[i] = renderItem(source[key], key, i);
+      }
+    }
+  } else {
+    ret = [];
+  }
+  return ret;
+}
+const o = (value, key) => vOn(value, key);
+const f = (source, renderItem) => vFor(source, renderItem);
+const t = (val) => toDisplayString(val);
 function createApp$1(rootComponent, rootProps = null) {
   rootComponent && (rootComponent.mpType = "app");
   return createVueApp(rootComponent, rootProps).use(plugin);
@@ -5011,9 +5171,9 @@ function assertType(value, type) {
   let valid;
   const expectedType = getType(type);
   if (isSimpleType(expectedType)) {
-    const t = typeof value;
-    valid = t === expectedType.toLowerCase();
-    if (!valid && t === "object") {
+    const t2 = typeof value;
+    valid = t2 === expectedType.toLowerCase();
+    if (!valid && t2 === "object") {
       valid = value instanceof type;
     }
   } else if (expectedType === "Object") {
@@ -7700,5 +7860,8 @@ const createSubpackageApp = initCreateSubpackageApp();
 }
 exports._export_sfc = _export_sfc;
 exports.createSSRApp = createSSRApp;
+exports.f = f;
 exports.index = index;
+exports.o = o;
+exports.t = t;
 //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map

+ 22 - 3
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/home/home.js

@@ -1,8 +1,27 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
-const _sfc_main = {};
-function _sfc_render(_ctx, _cache) {
-  return {};
+const _sfc_main = {
+  methods: {
+    getList() {
+      common_vendor.index.request({
+        url: "https://m.douban.com/rexxar/api/v2/subject_collection/tv_domestic/items?start=0&count=8",
+        //仅为示例,并非真实接口地址。
+        header: {
+          "custom-header": "hello"
+          //自定义请求头信息
+        },
+        method: "GET",
+        success: (res) => {
+          common_vendor.index.__f__("log", "at pages/home/home.vue:29", res.data);
+        }
+      });
+    }
+  }
+};
+function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
+  return {
+    a: common_vendor.o((...args) => $options.getList && $options.getList(...args))
+  };
 }
 const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-07e72d3c"]]);
 wx.createPage(MiniProgramPage);

+ 1 - 1
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/home/home.wxml

@@ -1 +1 @@
-<view class="home data-v-07e72d3c"> 首页 <view class="box data-v-07e72d3c"></view><icon class="data-v-07e72d3c" type="success" size="26"/><icon class="data-v-07e72d3c" type="clear" size="26"/><icon class="data-v-07e72d3c" type="search" size="26"/><view class="h1 data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="emsp">今 三</text><view class="data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="nbsp">今 三</text><view class="data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="ensp">今 三</text></view>
+<view class="home data-v-07e72d3c"> 首页 <view class="box data-v-07e72d3c"></view><icon class="data-v-07e72d3c" type="success" size="26"/><icon class="data-v-07e72d3c" type="clear" size="26"/><icon class="data-v-07e72d3c" type="search" size="26"/><view class="h1 data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="emsp">今 三</text><view class="data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="nbsp">今 三</text><view class="data-v-07e72d3c">你好</view><text class="data-v-07e72d3c" space="ensp">今 三</text><button class="data-v-07e72d3c" bindtap="{{a}}">获取列表信息</button></view>

+ 54 - 4
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/list/list.js

@@ -1,9 +1,59 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
-const _sfc_main = {};
-function _sfc_render(_ctx, _cache) {
-  return {};
+const _sfc_main = {
+  data() {
+    return {
+      list: [
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二",
+        "星期一",
+        "星期二"
+      ]
+    };
+  },
+  onPullDownRefresh() {
+    common_vendor.index.__f__("log", "at pages/list/list.vue:24", "下拉中");
+    setTimeout(() => {
+      common_vendor.index.stopPullDownRefresh();
+    }, 2e3);
+  },
+  onReachBottom() {
+    common_vendor.index.__f__("log", "at pages/list/list.vue:30", "触底");
+    let arr = ["孙悟空", "猪八戒", "沙和尚"];
+    this.list = [...this.list, ...arr];
+  }
+};
+function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
+  return {
+    a: common_vendor.t($data.list),
+    b: common_vendor.f($data.list, (item, index, i0) => {
+      return {
+        a: common_vendor.t(item),
+        b: index
+      };
+    })
+  };
 }
-const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
+const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-98a9e0b2"]]);
 wx.createPage(MiniProgramPage);
 //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/list/list.js.map

+ 2 - 0
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/list/list.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "列表",
+  "enablePullDownRefresh": true,
+  "onReachBottomDistance": 0,
   "usingComponents": {}
 }

+ 1 - 1
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/list/list.wxml

@@ -1 +1 @@
-<view class="list"> list </view>
+<view class="list data-v-98a9e0b2">{{a}} <view wx:for="{{b}}" wx:for-item="item" wx:key="b" class="data-v-98a9e0b2"><view class="box-item data-v-98a9e0b2">{{item.a}}</view></view></view>

+ 29 - 0
18.uniapp小程序/project1/unpackage/dist/dev/mp-weixin/pages/list/list.wxss

@@ -0,0 +1,29 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+/* 颜色变量 */
+/* 行为相关颜色 */
+/* 文字基本颜色 */
+/* 背景颜色 */
+/* 边框颜色 */
+/* 尺寸变量 */
+/* 文字尺寸 */
+/* 图片尺寸 */
+/* Border Radius */
+/* 水平间距 */
+/* 垂直间距 */
+/* 透明度 */
+/* 文章场景相关 */
+.box-item.data-v-98a9e0b2 {
+  height: 50rpx;
+  line-height: 50rpx;
+}

+ 24 - 0
18.uniapp小程序/project1/utils/request.js

@@ -0,0 +1,24 @@
+const BASE_URL = 'https://m.douban.com'
+export const newRequest = (options) => {
+	return new Promise((resolve,reject)=> {
+		uni.request({
+		    url: BASE_URL + options.url, //仅为示例,并非真实接口地址。
+			method: options.method || 'GET',
+		    data: options.data || {},
+		    header: {
+		        'custom-header': 'hello' //自定义请求头信息
+		    },
+		    success: (res) => {
+		        console.log(res.data);
+				resolve(res);
+		    },
+			fail:(err) => {
+				uni.showToast({
+					title:"请求失败"
+				})
+				reject(err);
+			}
+		});
+
+	})
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels