Code Monkey home page Code Monkey logo

ithome-lite's Introduction

ithome-lite (WEB 版)

IT之家小程序版客户端

相关依赖

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

项目模板

$ vue init F-loat/mpvue-quickstart my-project

截图展示

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

运行步骤

  • 安装依赖 $ npm install

  • 编译运行

    • 小程序 $ npm run dev
    • 网页 $ npm run dev:h5
  • 生产构建

    • 小程序 $ npm run build
    • 网页 $ npm run build:h5
  • 查看调试

    • 小程序 使用微信开发者工具打开项目目录
    • 网页 通过浏览器访问 localhost:8080

Tips

  • flyio 使用方法

具体内容参见 微信小程序中使用flyio,这里提示下小程序中需要引入的是 flyio/dist/npm/wx.js,而网页中则需要引用 flyio/dist/npm/fly.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 列表

相关文章

ithome-lite's People

Contributors

f-loat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.