Skip to content

IT之家小程序版客户端(使用 Mpvue 开发,兼容 Web)

License

Notifications You must be signed in to change notification settings

archerding/ithome-lite

 
 

Repository files navigation

ithome-lite (WEB 版)

IT之家小程序版客户端

相关依赖

  • flyio - 同时支持浏览器、小程序、Node、Weex 及快应用的基于 Promise 的跨平台请求库
  • mpvue-entry - 集中式页面配置,不再需要重复编辑各页面的 main.js 文件
  • mpvue-router-patch - 在 mpvue 中使用 vue-router 兼容的路由写法
  • xmlstring2json - xml字符串转换 json 格式,适用于微信小程序

截图展示

新闻列表 新闻详情 圈子列表

Tips

  • flyio 使用方法

具体内容参见 微信小程序中使用flyio,这里提示下小程序中需要引入的是 flyio/dist/npm/wx.js 这个文件,可以配置下 webpack 的 alias 方便调用

alias: {
  '@': resolve('src'),
  vue: 'mpvue',
  flyio: 'flyio/dist/npm/wx',
  wx: resolve('src/utils/wx')
}
  • vuex 使用方法

建立 src/store/index.js 文件

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
  },
  mutations: {
  },
  actions: {
  }
})

export default store

src/main.js 中引用

import Vue from 'vue'
import store from '@/store'
import App from '@/App'

const app = new Vue({
  store,
  ...App
}).$mount()

最后在需要使用 vuex 的页面相对应的 main.js 文件中像 src/main.js 一样引用即可

部分 api 列表

相关文章

About

IT之家小程序版客户端(使用 Mpvue 开发,兼容 Web)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 66.7%
  • Vue 32.7%
  • Other 0.6%