温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

微信小程序实现访问公众号文章的方法

发布时间:2021-02-05 10:57:03 阅读:965 作者:小新 栏目:web开发
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇文章给大家分享的是有关微信小程序实现访问公众号文章的方法的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

主要代码:

<web-view src="https://mp.weixin.qq.com/s?__biz=MzI2ODUxMzg4Nw==&mid=2247485016&idx=1&sn=e5f60600ea30f669264ddcf5db4fb080&chksm=eaef2168dd98a87ead60eed0f24e799c1befbfe95e341231216af72315c33a56839f92e69ef9&token=29762947&lang=zh_CN#rd"></web-view>

为了达到效果,更加具体的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="/images/search.png" bindtap="tapSearch" />
 </view>
</navigator>

<view class="container">
 <view wx:for="{{cardTeams}}" wx:key="{{cardTeam.viewid}}" wx:for-item="cardTeam" class="item" bindtap="bindViewTap">
  <image class="img" src="{{cardTeam.imgsrc}}" mode="scaleToFill"></image>
  <view class="number-wrapper">
   <text class="name">{{cardTeam.name}}</text>
   <view class="count-wrapper">
    <text class="count">{{cardTeam.count}}</text>
   </view>
  </view>
 </view>
</view>

weixin.wxss

.container {
 padding-top0;
}

.item {
 width100%;
 height220rpx;
 position: relative;
 display: flex;
 margin10rpx 10rpx;
 border-bottom1px solid rgb(197199199);
}

.item:first-child {
 margin-top0;
}

.item .remove {
 width60px;
 height100%;
 background-color: red;
 position: absolute;
 top0;
 right: -60px;
 display: flex;
 justify-content: center;
 align-items: center;
}

.item .number-wrapper {
 height100%;
 padding-top40rpx;
 flex-direction: column;
 justify-content: space-between;
}

.item .ok {
 width60px;
 height100%;
 padding-right20rpx;
 display: flex;
 justify-content: center;
 align-items: center;
 background-color#98f5ff;
}

.item .img {
 width150rpx;
 height150rpx;
 padding20rpx;
}

.number-wrapper .name {
 margin10rpx 10rpx 10rpx 10rpx;
 font-size39rpx;
 overflow: hidden;
}

.number-wrapper .count-wrapper {
 display: flex;
 align-items: center;
 margin-left10rpx;
 font-size25rpx;
}

.number-wrapper .count-wrapper .decrease-btn {
 font-size30rpx;
}

.number-wrapper .count-wrapper .increase-btn {
 font-size30rpx;
}

.number-wrapper .count-wrapper .count {
 margin0 1rpx 0 1rpx;
 font-size30rpx;
}

.number-wrapper .price-wrapper .people {
 margin-left250rpx;
 font-size30rpx;
}

/* 搜索框样式 */

.view-search {
 display: flex;
 flex-direction: row;
 height70rpx;
 margin20rpx;
 padding5rpx;
 border1px #e4e2e2 solid;
 border-width: thin;
 align-items: center;
}

.input {
 flex1;
 height60rpx;
}

.input-placeholder {
 color#999;
}

.button {
 width60rpx;
 height60rpx;
}

weixin.js

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

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

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

   }, {
    "viewid""3",
    "imgsrc""../../images/win/3.jpg",
    "price""&yen;2345",

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

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

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

   }
  ]
 },

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

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

 }

})

文章界面

weixinlink.wxml

<web-view src="https://mp.weixin.qq.com/s?__biz=MzI2ODUxMzg4Nw==&mid=2247485427&idx=1&sn=ebfb8851c6cbb0d40c93f8ecbda83687&chksm=eaef20c3dd98a9d5a19f5ad195888c603c8c819021bab602d11f9aa757b66475d39d23f664c4&token=1408526571&lang=zh_CN#rd"></web-view>

注意:

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

感谢各位的阅读!关于“微信小程序实现访问公众号文章的方法”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×