浏览代码

跳转小程序6

zhangyujun 3 年之前
父节点
当前提交
315c7f936b
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/views/mini/index.vue

+ 5 - 1
src/views/mini/index.vue

@@ -1,5 +1,6 @@
 <template>
 	<div>
+		<div v-text="weappHtml"></div>
 		<!-- <wx-open-launch-weapp style="display: inline-block; border: none" id="launch-btn" username="gh_a994fd2f498e" path="pages/index/index.html?living_code=LIVING_CODE">
 			<div v-is="'script'" type="text/wxtag-template">
 				<div v-is="'style'">.openbtn{background-color:#38f;color:#f40;width:100px;height:40px;line-height:40px;}</div>
@@ -16,7 +17,7 @@ export default defineComponent({
 	setup() {
 		openApi
 			.jspapi({
-				url: encodeURIComponent(window.location.href)
+				url: encodeURIComponent(window.location.href),
 			})
 			.then((res) => {
 				let wxConfig = {
@@ -38,6 +39,9 @@ export default defineComponent({
 					jsApiList: ["previewImage"], // 必填,需要使用的JS接口列表
 					openTagList: [], // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
 				});
+				wx.error(({ errMsg }) => {
+					weappHtml.value = errMsg;
+				});
 			});
 
 		let isWxReady = ref(false);