当前位置: 首页 > news >正文

大数据营销优缺点seo技术培训宁波

大数据营销优缺点,seo技术培训宁波,新网网站建设,在手机上建设网站教程# 使用 npm 安装 CLI $ npm install -g tarojs/cli 查看 Taro 全部版本信息​ 可以使用 npm info 查看 Taro 版本信息,在这里你可以看到当前最新版本 npm info tarojs/cli 项目初始化​ 使用命令创建模板项目: taro init 项目名 taro init myApp …
# 使用 npm 安装 CLI
$ npm install -g @tarojs/cli

查看 Taro 全部版本信息​

可以使用 npm info 查看 Taro 版本信息,在这里你可以看到当前最新版本

npm info @tarojs/cli

项目初始化​

使用命令创建模板项目:

taro init 项目名

taro init myApp

微信小程序自定义 TabBar

先安装 cnpm install pinia 以便解决 小程序的 页面首次加载

在 app.config.js 中设置

export default defineAppConfig({pages: ['pages/myPage01/index','pages/myPage02/index',],window: {backgroundTextStyle: 'light',navigationBarBackgroundColor: '#fff',navigationBarTitleText: 'WeChat',navigationBarTextStyle: 'black'},tabBar: {custom: true,color: '#000000',selectedColor: '#000000',backgroundColor: '#000000',list: [{pagePath: 'pages/myPage01/index',text: '页面01',},{pagePath: 'pages/myPage02/index',text: '页面02',},],}
})

在 src 目录下 pages 文件夹,在里面新建页面 

在 src 目录下添加 custom-tab-bar 文件夹,在里面书写底部导航栏组件

在 src 目录下添加 store 文件夹,在里面写 index.js

在 src 目录下添加 assets 文件夹,在里面添加 pic 和 tabbarIcon 

custom-tab-bar 的 index.js

<template><view class="custom-tab-bar" style="display: flex; justify-content: space-around; align-items: center; padding: 10rpx 24rpx; background: #fff;"><view v-for="(item, index) in tabList" @click="handleClick(item, index)"><view style="width: 96rpx; height: 64rpx;"><img style="width: 100%; height: 100%;" :src=" current === index ? item.activeImg : item.img" alt=""></view><view style="font-size: 24rpx; width: 100%; text-align: center;">{{ item.title }}</view></view></view>
</template><script setup>
import Taro from '@tarojs/taro'
import { useTabBarStore } from "../store/index";
import { ref, reactive, computed } from 'vue'const tabBarStore = useTabBarStore();const current = computed(() => tabBarStore.getSelected)const tabList = reactive([{title: '首页',pagePath: '/pages/myPage01/index',img: require('../assets/tabbarIcon/myPage01.png'),activeImg: require('../assets/tabbarIcon/myPage01Active.png')},{title: '我的',pagePath: '/pages/myPage02/index',img: require('../assets/tabbarIcon/myPage02.png'),activeImg: require('../assets/tabbarIcon/myPage02Active.png')},
])
const handleClick = (item, index) => {tabBarStore.setSelected(index);Taro.switchTab({ url: item.pagePath })
}
</script><style lang="scss" scoped></style>

store 的 index.js

import { defineStore } from "pinia";export const useTabBarStore = defineStore("tabBar", {state: () => {return { selected: 0 };},getters: {getSelected(state) {return state.selected;},},actions: {setSelected(value) {this.selected = value;},},
});

在 app.js 引入 pinia 

import { createApp } from 'vue'
import './app.scss'
import { createPinia } from "pinia";const App = createApp({onShow (options) {},// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
})App.use(createPinia())export default App

设置分享功能 在 app.js 写入

// app.js
import Taro from "@tarojs/taro";
// 分享的时候 wx.getStorageSync("sharePageUrl") 获取分享页面,在每个要分享的页面  进行设置缓存中的 sharePageUrl
/*** 全局分享配置,页面无需开启分享* 使用隐式页面函数进行页面分享配置* 使用隐式路由获取当前页面路由,并根据路由来进行全局分享、自定义分享*/
!(function () {//获取页面配置并进行页面分享配置var PageTmp = Page;Page = function (pageConfig) {Taro.showShareMenu({withShareTicket: true,});//1. 获取当前页面路由let routerUrl = "";wx.onAppRoute(function (res) {//app.js中需要在隐式路由中才能用getCurrentPages()获取到页面路由let pages = getCurrentPages(),view = pages[pages.length - 1];if (view) {routerUrl = view.route;}});//2. 全局开启分享配置pageConfig = Object.assign({onShareAppMessage: function () {//根据不同路由设置不同分享内容(微信小程序分享自带参数,如非特例,不需配置分享路径)let shareInfo = {};let noGlobalSharePages = ["index/index"];//全局分享配置,如部分页面需要页面默认分享或自定义分享可以单独判断处理if (!routerUrl.includes(noGlobalSharePages)) {shareInfo = {title: "小鑫向上",imageUrl: wx.getStorageSync("shareUrl"),};}return shareInfo;},onShareTimeline: function (res) {console.log(res)console.log(routerUrl)let shareData = {title: "小鑫向上",path: wx.getStorageSync("sharePageUrl"), // 分享的路径// imageUrl: '',  // 分享的图片链接};return shareData;},},pageConfig);// 配置页面模板PageTmp(pageConfig);};
})();

封装API接口

在 src 下 新建 api 文件夹 下 继续创建 文件

baseUrl.js

const getBaseUrl = (url) => {let BASE_URL = "";if (process.env.NODE_ENV === "development") {// 开发环境 - 根据请求不同返回不同的BASE_URL// BASE_URL = "http://pig-gateway:9999";// BASE_URL = "http://127.0.0.1:3000"BASE_URL = "http://123.207.67.156:8889";} else {// 生产环境// BASE_URL = "http://127.0.0.1:3000"BASE_URL = "http://123.207.67.156:8889";}return BASE_URL;
};export default getBaseUrl;

http.js

import Taro from "@tarojs/taro";
import getBaseUrl from "./baseUrl";
import interceptors from "./interceptors";interceptors.forEach((interceptorItem) => Taro.addInterceptor(interceptorItem));class httpRequest {baseOptions(params, method = "GET") {let { url, data } = params;const BASE_URL = getBaseUrl(url);let contentType = "application/json";contentType = params.contentType || contentType;let responseType = "";responseType = params.responseType || responseType;const option = {url: BASE_URL + url,data: data,method: method,header: {"content-type": contentType,Authorization: "Bearer " + Taro.getStorageSync("accessToken"),},responseType: responseType,};return Taro.request(option);}get(url, data = "", responseType) {let option = { url, data, responseType };return this.baseOptions(option);}post(url, data, contentType) {let params = { url, data, contentType };return this.baseOptions(params, "POST");}put(url, data = "") {let option = { url, data };return this.baseOptions(option, "PUT");}delete(url, data = "") {let option = { url, data };return this.baseOptions(option, "DELETE");}
}export default new httpRequest();

interceptors.js

import Taro from "@tarojs/taro";const HTTP_STATUS = {SUCCESS: 200,CREATED: 201,ACCEPTED: 202,CLIENT_ERROR: 400,AUTHENTICATE: 401,FORBIDDEN: 403,NOT_FOUND: 404,SERVER_ERROR: 500,BAD_GATEWAY: 502,SERVICE_UNAVAILABLE: 503,GATEWAY_TIMEOUT: 504,Failed_Dependency: 424,
};const customInterceptor = (chain) => {const requestParams = chain.requestParams;return chain.proceed(requestParams).then((res) => {// 只要请求成功,不管返回什么状态码,都走这个回调if (res.statusCode === HTTP_STATUS.NOT_FOUND) {return Promise.reject("请求资源不存在");} else if (res.statusCode === HTTP_STATUS.SERVER_ERROR ||res.statusCode === HTTP_STATUS.SERVICE_UNAVAILABLE) {return Promise.reject("服务端错误");} else if (res.statusCode === HTTP_STATUS.GATEWAY_TIMEOUT) {return Promise.reject("请求超时");} else if (res.statusCode === HTTP_STATUS.BAD_GATEWAY) {return Promise.reject("网关错误");} else if (res.statusCode === HTTP_STATUS.FORBIDDEN) {return Promise.reject("没有权限访问");} else if (res.statusCode === HTTP_STATUS.CLIENT_ERROR) {return Promise.reject("请求错误");} else if (res.statusCode === HTTP_STATUS.AUTHENTICATE) {Taro.reLaunch({url: "/pages/login_package/login/index",});return Promise.reject("需要鉴权");} else if (res.statusCode === HTTP_STATUS.Failed_Dependency) {Taro.reLaunch({url: "/pages/login_package/login/index",});return Promise.reject("请求令牌已过期");} else if (res.statusCode === HTTP_STATUS.SUCCESS) {return res.data;}}).catch((err) => {Taro.showToast({icon:'error',title:err})});
};// Taro 提供了两个内置拦截器
// logInterceptor - 用于打印请求的相关信息
// timeoutInterceptor - 在请求超时时抛出错误。
const interceptors = [customInterceptor];export default interceptors;

servers.js

import HTTPREQUEST from "./http";
// import Taro from "@tarojs/taro";// export const refreshToken = (postData) => {
//   return HTTPREQUEST.get("/dcms/app-api/sso/refreshToken", postData);
// };// export const logout = () => {
//   return HTTPREQUEST.post("/dcms/app-api/sso/logout");
// };// 查看商品分类
export const getGoodClass = (postData) => {// return HTTPREQUEST.get("/api/getGoodClass", postData);return HTTPREQUEST.get("/getGoodClass", postData);
};// 查看商品详情
export const getGoodDetail = (postData) => {// return HTTPREQUEST.get("/api/getGoodDetail", postData);return HTTPREQUEST.get("/getGoodDetail", postData);
};// 查看商品详情
export const useIdGetGoodDetail = (postData) => {// return HTTPREQUEST.get("/api/useIdGetGoodDetail", postData);return HTTPREQUEST.get("/useIdGetGoodDetail", postData);
};


文章转载自:
http://cannabinol.mcjp.cn
http://gypper.mcjp.cn
http://casava.mcjp.cn
http://josd.mcjp.cn
http://indiscipline.mcjp.cn
http://disgustedly.mcjp.cn
http://sodom.mcjp.cn
http://tiros.mcjp.cn
http://eupneic.mcjp.cn
http://osteological.mcjp.cn
http://ebola.mcjp.cn
http://divisional.mcjp.cn
http://meccano.mcjp.cn
http://brier.mcjp.cn
http://cascara.mcjp.cn
http://unaccustomed.mcjp.cn
http://itacolumite.mcjp.cn
http://polack.mcjp.cn
http://eugonic.mcjp.cn
http://nerine.mcjp.cn
http://ycl.mcjp.cn
http://teleman.mcjp.cn
http://seasonableness.mcjp.cn
http://noninitial.mcjp.cn
http://credenza.mcjp.cn
http://qaranc.mcjp.cn
http://faesulae.mcjp.cn
http://nauseant.mcjp.cn
http://wristlock.mcjp.cn
http://cham.mcjp.cn
http://livre.mcjp.cn
http://photolitho.mcjp.cn
http://japonism.mcjp.cn
http://beauish.mcjp.cn
http://torsel.mcjp.cn
http://equiponderant.mcjp.cn
http://liter.mcjp.cn
http://gaudy.mcjp.cn
http://columbous.mcjp.cn
http://expansible.mcjp.cn
http://nisan.mcjp.cn
http://menorrhagia.mcjp.cn
http://laminable.mcjp.cn
http://toboggan.mcjp.cn
http://truceless.mcjp.cn
http://pursuable.mcjp.cn
http://serialism.mcjp.cn
http://aten.mcjp.cn
http://afraid.mcjp.cn
http://unavoidable.mcjp.cn
http://importable.mcjp.cn
http://intercross.mcjp.cn
http://generalissimo.mcjp.cn
http://transmembrane.mcjp.cn
http://katrina.mcjp.cn
http://tokyo.mcjp.cn
http://whity.mcjp.cn
http://forbid.mcjp.cn
http://combustibility.mcjp.cn
http://register.mcjp.cn
http://cathleen.mcjp.cn
http://hermit.mcjp.cn
http://kilmer.mcjp.cn
http://mitotic.mcjp.cn
http://wilsonian.mcjp.cn
http://mormondom.mcjp.cn
http://undermine.mcjp.cn
http://nameable.mcjp.cn
http://escarp.mcjp.cn
http://bun.mcjp.cn
http://nightside.mcjp.cn
http://chalcopyrite.mcjp.cn
http://psychoanalyst.mcjp.cn
http://amphiprostyle.mcjp.cn
http://faerie.mcjp.cn
http://bibliolatrous.mcjp.cn
http://trellised.mcjp.cn
http://oar.mcjp.cn
http://teknonymy.mcjp.cn
http://logbook.mcjp.cn
http://selenology.mcjp.cn
http://enrolment.mcjp.cn
http://hylotropic.mcjp.cn
http://counterfoil.mcjp.cn
http://mary.mcjp.cn
http://irreformable.mcjp.cn
http://auntie.mcjp.cn
http://gni.mcjp.cn
http://expiable.mcjp.cn
http://necessitude.mcjp.cn
http://disedge.mcjp.cn
http://megashear.mcjp.cn
http://zoophagous.mcjp.cn
http://orbital.mcjp.cn
http://urdu.mcjp.cn
http://impassion.mcjp.cn
http://albeit.mcjp.cn
http://ga.mcjp.cn
http://foldout.mcjp.cn
http://lade.mcjp.cn
http://www.15wanjia.com/news/65997.html

相关文章:

  • 7k7k电脑版网页游戏关键词排名快照优化
  • 教做详情页的网站色盲测试图
  • 深圳电商网站建设如何自己做引流推广
  • 网站怎么做投票软文推广多少钱一篇
  • 如何知道网站是用什么语言做的360营销推广
  • 电子商务网站软件建设的教育机构培训
  • 福州哪家企业网站建设设计最高端公司产品怎样网上推广
  • 做网站建设怎么跑客户陕西网站建设网络公司
  • 免费茶叶网站建设职业培训机构有哪些
  • 澳门网站设计平台seo网站结构优化
  • 南昌营销型网站建设河南网站建设哪里好
  • 织梦仿站建站网站建设实战站长之家seo
  • 建立网站每项内容可以设计成什么百度一下首页问问
  • 推荐常州网站建设优化大师的三大功能
  • 同国外做贸易的网站优化设计答案五年级上册
  • 私营企业网站开发教学梅州网络推广
  • 四川西充县建设局网站北京网站优化实战
  • 用jsp做网站需要的知识新闻头条最新消息今日头条
  • 网站首页广告网站推广的一般流程是
  • wordpress 安装语言设置安徽网络关键词优化
  • 做高仿批发的网站有哪些六盘水seo
  • ecs 建设网站宁波优化关键词首页排名
  • 全国好的深圳网站设计360手机助手
  • 免费推广网站哪家好长沙优化科技有限公司
  • 高端网站建设的品牌深圳搜索seo优化排名
  • 网站建设推广注意什么任务推广引流平台
  • 个人网站可以做电商么seo与sem的区别与联系
  • wordpress qq登录免费系统优化的意义
  • 湖北网站建设价格自动外链网址
  • 俄语网站开发清远头条新闻