相思资源网 Design By www.200059.com

前言

随着小程序不断的发展,现在个人的小程序也开放了很多功能了,个人小程序直接打开公众号链接。在群里看到的一款小程序,点击可以直接阅读文章了,所以琢磨了一下,写了一些源码。

主要代码:

<web-view src="/UploadFiles/2021-04-02/s">

为了达到效果,更加具体的demo

效果如下

github地址:https://github.com/wangxiaoting666/weixinlink

微信小程序如何访问公众号文章

weixin.wxml

<navigator url="/pages/search/search" hover-class="changestyle">
 <view class="view-search">
  <input class="input" placeholder-class="input-placeholder" placeholder="输入文章和链接" bindinput="bindSearchInput" />
  <image class="button" src="/UploadFiles/2021-04-02/search.png">

weixin.wxss

.container {
 padding-top: 0;
}

.item {
 width: 100%;
 height: 220rpx;
 position: relative;
 display: flex;
 margin: 10rpx 10rpx;
 border-bottom: 1px solid rgb(197, 199, 199);
}

.item:first-child {
 margin-top: 0;
}

.item .remove {
 width: 60px;
 height: 100%;
 background-color: red;
 position: absolute;
 top: 0;
 right: -60px;
 display: flex;
 justify-content: center;
 align-items: center;
}

.item .number-wrapper {
 height: 100%;
 padding-top: 40rpx;
 flex-direction: column;
 justify-content: space-between;
}

.item .ok {
 width: 60px;
 height: 100%;
 padding-right: 20rpx;
 display: flex;
 justify-content: center;
 align-items: center;
 background-color: #98f5ff;
}

.item .img {
 width: 150rpx;
 height: 150rpx;
 padding: 20rpx;
}

.number-wrapper .name {
 margin: 10rpx 10rpx 10rpx 10rpx;
 font-size: 39rpx;
 overflow: hidden;
}

.number-wrapper .count-wrapper {
 display: flex;
 align-items: center;
 margin-left: 10rpx;
 font-size: 25rpx;
}

.number-wrapper .count-wrapper .decrease-btn {
 font-size: 30rpx;
}

.number-wrapper .count-wrapper .increase-btn {
 font-size: 30rpx;
}

.number-wrapper .count-wrapper .count {
 margin: 0 1rpx 0 1rpx;
 font-size: 30rpx;
}

.number-wrapper .price-wrapper .people {
 margin-left: 250rpx;
 font-size: 30rpx;
}

/* 搜索框样式 */

.view-search {
 display: flex;
 flex-direction: row;
 height: 70rpx;
 margin: 20rpx;
 padding: 5rpx;
 border: 1px #e4e2e2 solid;
 border-width: thin;
 align-items: center;
}

.input {
 flex: 1;
 height: 60rpx;
}

.input-placeholder {
 color: #999;
}

.button {
 width: 60rpx;
 height: 60rpx;
}

weixin.js

//index.js
//获取应用实例
var app = getApp();
var cardTeams;

Page({
 data: {
  cardTeams: [{
    "viewid": "1",
    "imgsrc": "../../images/win/1.jpg",
    "price": "¥1245",
    "count": "一个40岁老码农的总结,",
    "name": "一个40岁老码农的总结,奋斗",

   }, {
    "viewid": "2",
    "imgsrc": "../../images/win/2.jpg",
    "price": "¥2345",
    "count": "小公司打杂三年,意外拿到",
    "name": "小公司打杂三年,意外拿到美",

   }, {
    "viewid": "3",
    "imgsrc": "../../images/win/3.jpg",
    "price": "¥2345",

    "count": "作为一个有追求的前端程序媛作",
    "name": "作为一个有追求的前端程序媛",

   }, {
    "viewid": "4",
    "imgsrc": "../../images/win/4.jpg",
    "price": "¥2345",
    "count": "女程序媛面试总结:我",
    "name": "女程序媛面试总结:我是这",

   },
   {
    "viewid": "5",
    "imgsrc": "../../images/win/5.jpg",
    "price": "¥2345",
    "count": "前端工作那些年,怎么避?",
    "name": "前端工作那些年,怎么避免",

   }
  ]
 },

 //事件处理函数
 bindViewTap: function() {
  wx.navigateTo({
   url: '../weixinlink/weixinlink'

  })
 },
 onLoad: function() {
  console.log('onLoad:' + app.globalData.domain)

 }

})

文章界面

weixinlink.wxml

<web-view src="/UploadFiles/2021-04-02/s">

注意:

小程序要和公众号关联,链接才可以打开。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

标签:
微信小程序,访问,公众号文章

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“微信小程序如何访问公众号文章”

暂无微信小程序如何访问公众号文章的评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。