├── taro ├── src │ ├── app.css │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── pages │ │ └── index │ │ │ ├── index.css │ │ │ └── index.jsx │ ├── index.html │ ├── app.jsx │ └── components │ │ └── card │ │ ├── card.css │ │ └── card.jsx ├── .gitignore ├── config │ ├── dev.js │ ├── prod.js │ └── index.js ├── .eslintrc ├── .editorconfig ├── project.config.json └── package.json ├── wechat ├── app.wxss ├── app.js ├── components │ └── card │ │ ├── card.json │ │ ├── card.js │ │ └── card.wxml ├── utils │ ├── config.js │ ├── interface.js │ └── performance.polyfill.js ├── pages │ └── index │ │ ├── index.wxss │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.js ├── sitemap.json ├── app.json └── project.config.json ├── mpvue ├── static │ └── .gitkeep ├── config │ ├── prod.env.js │ ├── dev.env.js │ └── index.js ├── src │ ├── App.vue │ ├── pages │ │ └── index │ │ │ ├── main.js │ │ │ ├── main.json │ │ │ └── index.vue │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── app.json │ ├── main.js │ └── components │ │ └── banner.vue ├── .postcssrc.js ├── .editorconfig ├── .gitignore ├── project.swan.json ├── package.swan.json ├── index.html ├── build │ ├── dev-client.js │ ├── vue-loader.conf.js │ ├── build.js │ ├── check-versions.js │ ├── webpack.dev.conf.js │ ├── utils.js │ ├── dev-server.js │ └── webpack.base.conf.js ├── .babelrc ├── project.config.json ├── README.md └── package.json ├── taro-next ├── src │ ├── app.css │ ├── pages │ │ └── index │ │ │ ├── index.css │ │ │ ├── index.config.ts │ │ │ └── index.jsx │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── app.config.ts │ ├── app.ts │ ├── index.html │ └── components │ │ └── card │ │ ├── card.css │ │ └── card.jsx ├── .vscode │ └── settings.json ├── .gitignore ├── .npmignore ├── .eslintrc.js ├── .editorconfig ├── babel.config.js ├── project.config.json ├── config │ ├── dev.js │ ├── prod.js │ └── index.js ├── global.d.ts ├── tsconfig.json └── package.json ├── kbone ├── .eslintignore ├── src │ ├── store │ │ ├── mutations.js │ │ ├── actions.js │ │ └── index.js │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── App.vue │ ├── main.js │ ├── router │ │ └── index.js │ ├── mp │ │ └── home │ │ │ └── main.mp.js │ └── home │ │ └── Index.vue ├── index.html ├── .babelrc ├── build │ ├── webpack.perf.config.js │ ├── miniprogram.config.js │ ├── webpack.dev.config.js │ ├── webpack.base.config.js │ └── webpack.prod.config.js ├── tsconfig.json ├── LICENSE ├── .gitignore ├── .eslintrc.js ├── README.md └── package.json ├── chameleon ├── src │ ├── store │ │ ├── getters.js │ │ ├── actions.js │ │ ├── mutations.js │ │ ├── state.js │ │ └── index.js │ ├── assets │ │ └── images │ │ │ └── chameleon.png │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── router.config.json │ ├── app │ │ └── app.cml │ └── pages │ │ └── index │ │ └── index.cml ├── .gitignore ├── mock │ ├── template │ │ └── index.php │ └── api │ │ └── index.js ├── package.json ├── chameleon.config.js └── npm-shrinkwrap.json ├── wepy ├── .gitignore ├── .prettierrc ├── .wepyignore ├── src │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── app.wpy │ └── pages │ │ └── index.wpy ├── .editorconfig ├── project.config.json ├── package.json └── wepy.config.js ├── uni-app ├── src │ ├── static │ │ └── logo.png │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── main.js │ ├── App.vue │ ├── pages.json │ ├── pages │ │ └── index │ │ │ └── index.vue │ ├── uni.scss │ └── manifest.json ├── .gitignore ├── README.md ├── postcss.config.js ├── public │ └── index.html ├── babel.config.js └── package.json ├── uni-app-v3 ├── src │ ├── static │ │ └── logo.png │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── main.js │ ├── App.vue │ ├── pages.json │ ├── pages │ │ └── index │ │ │ └── index.vue │ ├── uni.scss │ └── manifest.json ├── .gitignore ├── README.md ├── postcss.config.js ├── public │ └── index.html ├── babel.config.js └── package.json ├── uniapp-vue3 ├── src │ ├── static │ │ └── logo.png │ ├── utils │ │ ├── config.js │ │ ├── interface.js │ │ └── performance.polyfill.js │ ├── main.js │ ├── App.vue │ ├── pages.json │ ├── uni.scss │ ├── pages │ │ └── index │ │ │ └── index.vue │ └── manifest.json ├── vite.config.js ├── postcss.config.js ├── .gitignore ├── index.html └── package.json └── LICENSE /taro/src/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wechat/app.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mpvue/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /taro-next/src/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /taro-next/src/pages/index/index.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kbone/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /*.js 4 | -------------------------------------------------------------------------------- /chameleon/src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | } 3 | -------------------------------------------------------------------------------- /wepy/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /wepy/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /chameleon/src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /chameleon/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /wechat/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | import './utils/perf.js' 3 | App({ 4 | }) -------------------------------------------------------------------------------- /chameleon/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | 5 | 6 | -------------------------------------------------------------------------------- /taro-next/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /wepy/.wepyignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .DS_Store 4 | *.wpy___jb_tmp___ 5 | -------------------------------------------------------------------------------- /taro/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | .temp/ 3 | .rn_temp/ 4 | node_modules/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /mpvue/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /taro-next/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | .temp/ 3 | .rn_temp/ 4 | node_modules/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /chameleon/src/store/state.js: -------------------------------------------------------------------------------- 1 | 2 | const state = { 3 | } 4 | 5 | export default state 6 | -------------------------------------------------------------------------------- /wechat/components/card/card.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /mpvue/src/App.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /taro-next/.npmignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /uni-app/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcloudio/test-framework/HEAD/uni-app/src/static/logo.png -------------------------------------------------------------------------------- /uni-app-v3/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcloudio/test-framework/HEAD/uni-app-v3/src/static/logo.png -------------------------------------------------------------------------------- /uniapp-vue3/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcloudio/test-framework/HEAD/uniapp-vue3/src/static/logo.png -------------------------------------------------------------------------------- /kbone/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | export default { 2 | FAKE_MUTATION(state, input) { 3 | state.input = input 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /mpvue/src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /chameleon/src/assets/images/chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcloudio/test-framework/HEAD/chameleon/src/assets/images/chameleon.png -------------------------------------------------------------------------------- /mpvue/src/pages/index/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "enablePullDownRefresh": true, 3 | "backgroundTextStyle":"dark", 4 | "usingComponents":{} 5 | } -------------------------------------------------------------------------------- /taro/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: {}, 6 | mini: {}, 7 | h5: {} 8 | } 9 | -------------------------------------------------------------------------------- /kbone/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 5 2 | export const PERF_LIKE_MAX = 20 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = true 5 | -------------------------------------------------------------------------------- /mpvue/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-mpvue-wxss": {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /taro/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 10 2 | export const PERF_LIKE_MAX = 20 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = true 5 | -------------------------------------------------------------------------------- /uni-app-v3/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 10 2 | export const PERF_LIKE_MAX = 20 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = true 5 | -------------------------------------------------------------------------------- /chameleon/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 20 2 | export const PERF_LIKE_MAX = 10 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = true 5 | -------------------------------------------------------------------------------- /taro-next/src/pages/index/index.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | navigationBarTitleText: '仿微博 - taro版', 3 | enablePullDownRefresh: true, 4 | backgroundTextStyle: 'dark' 5 | } 6 | -------------------------------------------------------------------------------- /taro-next/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 30 2 | export const PERF_LIKE_MAX = 20 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = false 5 | -------------------------------------------------------------------------------- /wechat/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 10 2 | export const PERF_LIKE_MAX = 20 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = true 5 | 6 | -------------------------------------------------------------------------------- /kbone/src/store/actions.js: -------------------------------------------------------------------------------- 1 | export default { 2 | FAKE_ACTION({ commit }, input) { 3 | setTimeout(() => { 4 | commit('FAKE_MUTATION', input) 5 | }, 500) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /mpvue/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /taro-next/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'extends': [ 3 | // add more generic rulesets here, such as: 4 | // 'eslint:recommended', 5 | 'taro/react' 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /wechat/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /* 列表 */ 2 | .uni-list { 3 | background-color: #eee; 4 | position: relative; 5 | width: 100%; 6 | display: flex; 7 | flex-direction: column; 8 | } -------------------------------------------------------------------------------- /chameleon/mock/template/index.php: -------------------------------------------------------------------------------- 1 | "0", 4 | "errmsg"=> "", 5 | "pageData"=> array( 6 | "name"=>"chameleon", 7 | "age" => 10 8 | ) 9 | ); -------------------------------------------------------------------------------- /mpvue/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 20 2 | export const PERF_LIKE_MAX = 10 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = false // mpvue 未使用小程序自定义组件 5 | -------------------------------------------------------------------------------- /wepy/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 10 2 | export const PERF_LIKE_MAX = 10 3 | export const PERF_AUTO = true 4 | export const PERF_USING_COMPONENTS = false // mpvue 未使用小程序自定义组件 5 | -------------------------------------------------------------------------------- /wechat/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /taro/src/pages/index/index.css: -------------------------------------------------------------------------------- 1 | /* 列表 */ 2 | .uni-list { 3 | background-color: #eee; 4 | position: relative; 5 | width: 100%; 6 | display: flex; 7 | flex-direction: column; 8 | } 9 | -------------------------------------------------------------------------------- /mpvue/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /wepy/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /uni-app/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 1 2 | export const PERF_MAX_COUNT = 50 3 | export const PERF_LIKE_MAX = 20 4 | export const PERF_AUTO = true 5 | export const PERF_USING_COMPONENTS = true 6 | -------------------------------------------------------------------------------- /uniapp-vue3/src/utils/config.js: -------------------------------------------------------------------------------- 1 | export const PERF_MAX = 1 2 | export const PERF_MAX_COUNT = 50 3 | export const PERF_LIKE_MAX = 20 4 | export const PERF_AUTO = true 5 | export const PERF_USING_COMPONENTS = true 6 | -------------------------------------------------------------------------------- /mpvue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | -------------------------------------------------------------------------------- /mpvue/project.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "testappid", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uni-app-v3/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | //#ifdef MP-WEIXIN || MP-ALIPAY 4 | require('utils/perf.js') 5 | //#endif 6 | App.mpType = 'app' 7 | createApp(App).mount('#app') 8 | -------------------------------------------------------------------------------- /mpvue/package.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "touristappid", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uniapp-vue3/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import uni from '@dcloudio/vite-plugin-uni' 3 | // https://vitejs.dev/config/ 4 | export default defineConfig({ 5 | plugins: [ 6 | uni(), 7 | ], 8 | }) 9 | -------------------------------------------------------------------------------- /uniapp-vue3/postcss.config.js: -------------------------------------------------------------------------------- 1 | const { 2 | uniPostcssPlugin 3 | } = require('@dcloudio/uni-cli-shared') 4 | module.exports = { 5 | plugins: [ 6 | uniPostcssPlugin(), 7 | require('autoprefixer')() 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /kbone/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | -------------------------------------------------------------------------------- /wechat/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "仿微博 - 原生小程序版", 3 | "enablePullDownRefresh": true, 4 | "backgroundTextStyle": "dark", 5 | "usingComponents": { 6 | "card": "../../components/card/card" 7 | } 8 | } -------------------------------------------------------------------------------- /mpvue/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mpvue 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /taro/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["taro"], 3 | "rules": { 4 | "no-unused-vars": ["error", { "varsIgnorePattern": "Taro" }], 5 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }] 6 | }, 7 | "parser": "babel-eslint" 8 | } 9 | -------------------------------------------------------------------------------- /taro/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /taro-next/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /taro-next/babel.config.js: -------------------------------------------------------------------------------- 1 | // babel-preset-taro 更多选项和默认值: 2 | // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md 3 | module.exports = { 4 | presets: [ 5 | ['taro', { 6 | framework: 'react', 7 | ts: true 8 | }] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /mpvue/src/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/main" 4 | ], 5 | "window": { 6 | "backgroundTextStyle": "light", 7 | "navigationBarBackgroundColor": "#fff", 8 | "navigationBarTitleText": "仿微博 - mpvue版", 9 | "navigationBarTextStyle": "black" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chameleon/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/index/index", 8 | "name": "仿微博 - chameleon版", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /taro-next/src/app.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | pages: [ 3 | 'pages/index/index' 4 | ], 5 | window: { 6 | backgroundTextStyle: 'light', 7 | navigationBarBackgroundColor: '#fff', 8 | navigationBarTitleText: '仿微博 - taro版', 9 | navigationBarTextStyle: 'black' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /wechat/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mpvue/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /uni-app/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | 4 | //#ifdef MP-WEIXIN || MP-ALIPAY 5 | require('utils/perf.js') 6 | //#endif 7 | 8 | Vue.config.productionTip = false 9 | 10 | App.mpType = 'app' 11 | 12 | const app = new Vue({ 13 | ...App 14 | }) 15 | app.$mount() 16 | -------------------------------------------------------------------------------- /wechat/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index" 4 | ], 5 | "window": { 6 | "backgroundTextStyle": "light", 7 | "navigationBarBackgroundColor": "#fff", 8 | "navigationBarTitleText": "WeChat", 9 | "navigationBarTextStyle": "black" 10 | }, 11 | "sitemapLocation": "sitemap.json" 12 | } -------------------------------------------------------------------------------- /chameleon/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | import createStore from 'chameleon-store' 6 | 7 | export default createStore({ 8 | actions, 9 | getters, 10 | state, 11 | mutations 12 | }) 13 | -------------------------------------------------------------------------------- /wepy/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "A WePY project", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": false, 6 | "postcss": false, 7 | "minified": false 8 | }, 9 | "compileType": "miniprogram", 10 | "appid": "", 11 | "projectname": "wepy", 12 | "miniprogramRoot": "./dist" 13 | } 14 | -------------------------------------------------------------------------------- /kbone/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vue-kbone 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /kbone/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import actions from './actions' 4 | import mutations from './mutations' 5 | 6 | Vue.use(Vuex) 7 | 8 | export default new Vuex.Store({ 9 | state: { 10 | headerTips: 'hello', 11 | input: '', 12 | }, 13 | actions, 14 | mutations, 15 | }) 16 | -------------------------------------------------------------------------------- /taro/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./dist", 3 | "projectname": "taro-test", 4 | "description": "taro 性能测试", 5 | "appid": "touristappid", 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": false, 9 | "postcss": false, 10 | "minified": false 11 | }, 12 | "compileType": "miniprogram" 13 | } 14 | -------------------------------------------------------------------------------- /chameleon/mock/api/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = [ 3 | { 4 | method: ['get', 'post'], 5 | path: '/api/getMessage', 6 | controller: function (req, res, next) { 7 | res.json({ 8 | total: 0, 9 | message: [{ 10 | name: 'Hello chameleon!' 11 | }] 12 | }); 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /taro-next/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./dist", 3 | "projectname": "taro-next", 4 | "description": "taro 性能测试", 5 | "appid": "touristappid", 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": false, 9 | "postcss": false, 10 | "minified": false 11 | }, 12 | "compileType": "miniprogram" 13 | } 14 | -------------------------------------------------------------------------------- /uniapp-vue3/src/main.js: -------------------------------------------------------------------------------- 1 | import { 2 | createSSRApp 3 | } from "vue"; 4 | import App from "./App.vue"; 5 | //#ifdef MP-WEIXIN || MP-ALIPAY 6 | // require('@/utils/perf.js') 7 | import '@/utils/perf.js' 8 | //#endif 9 | export function createApp() { 10 | const app = createSSRApp(App); 11 | return { 12 | app, 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /uni-app/src/App.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /mpvue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | 4 | import { 5 | PerfPage, 6 | PerfComponent 7 | } from './utils/perf' 8 | 9 | global.Page = PerfPage 10 | global.Component = PerfComponent 11 | 12 | Vue.config.productionTip = false 13 | App.mpType = 'app' 14 | 15 | const app = new Vue(App) 16 | app.$mount() 17 | -------------------------------------------------------------------------------- /uni-app-v3/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | unpackage/ 4 | dist/ 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .project 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw* 24 | -------------------------------------------------------------------------------- /uni-app/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | unpackage/ 4 | dist/ 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .project 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw* 24 | -------------------------------------------------------------------------------- /uniapp-vue3/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | unpackage/ 4 | dist/ 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .project 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw* 24 | -------------------------------------------------------------------------------- /taro-next/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: { 6 | }, 7 | weapp: {}, 8 | h5: {}, 9 | mini: { 10 | prerender: { 11 | match: 'pages/card/**', // 所有以 `pages/shop/` 开头的页面都参与 prerender 12 | include: ['pages/card/card'], // `pages/any/way/index` 也会参与 prerender 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /uniapp-vue3/src/App.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /kbone/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import { sync } from 'vuex-router-sync' 6 | 7 | import './utils/perf' 8 | 9 | 10 | Vue.config.productionTip = false 11 | 12 | sync(store, router) 13 | 14 | new Vue({ 15 | el: '#app', 16 | router, 17 | store, 18 | render: h => h(App), 19 | }) 20 | -------------------------------------------------------------------------------- /mpvue/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /taro/config/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"production"' 4 | }, 5 | defineConstants: {}, 6 | mini: {}, 7 | h5: { 8 | /** 9 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 10 | * 参考代码如下: 11 | * webpackChain (chain) { 12 | * chain.plugin('analyzer') 13 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) 14 | * } 15 | */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /uni-app-v3/src/App.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /taro-next/config/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"production"' 4 | }, 5 | defineConstants: { 6 | }, 7 | weapp: {}, 8 | h5: { 9 | /** 10 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 11 | * 参考代码如下: 12 | * webpackChain (chain) { 13 | * chain.plugin('analyzer') 14 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) 15 | * } 16 | */ 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /uniapp-vue3/src/pages.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages 3 | { 4 | "path": "pages/index/index", 5 | "style": { 6 | "navigationBarTitleText": "uni-app" 7 | } 8 | } 9 | ], 10 | "globalStyle": { 11 | "navigationBarTextStyle": "black", 12 | "navigationBarTitleText": "uni-app", 13 | "navigationBarBackgroundColor": "#F8F8F8", 14 | "backgroundColor": "#F8F8F8" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /chameleon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleontest", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-api": "0.1.0", 11 | "chameleon-bridge": "0.1.0", 12 | "chameleon-runtime": "0.0.3", 13 | "chameleon-store": "0.0.3", 14 | "chameleon-ui-builtin": "0.0.6", 15 | "cml-ui": "0.0.6" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /uniapp-vue3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /uni-app-v3/src/pages.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | { 4 | "path": "pages/index/index", 5 | "style": { 6 | "navigationBarTitleText": "仿微博 - uni-app-vue3版", 7 | "enablePullDownRefresh": true, 8 | "backgroundTextStyle":"dark" 9 | } 10 | } 11 | ], 12 | "globalStyle": { 13 | "navigationBarTextStyle": "black", 14 | "navigationBarTitleText": "仿微博 - uni-app-vue3版", 15 | "navigationBarBackgroundColor": "#F8F8F8", 16 | "backgroundColor": "#F8F8F8" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kbone/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /uni-app/src/pages.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | { 4 | "path": "pages/index/index", 5 | "style": { 6 | "navigationBarTitleText": "仿微博 - uni-app版", 7 | "enablePullDownRefresh": true, 8 | "backgroundTextStyle":"dark" 9 | } 10 | } 11 | ], 12 | "globalStyle": { 13 | "navigationBarTextStyle": "black", 14 | "navigationBarTitleText": "仿微博 - uni-app版", 15 | "navigationBarBackgroundColor": "#F8F8F8", 16 | "backgroundColor": "#F8F8F8" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /taro-next/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.png'; 2 | declare module '*.gif'; 3 | declare module '*.jpg'; 4 | declare module '*.jpeg'; 5 | declare module '*.svg'; 6 | declare module '*.css'; 7 | declare module '*.less'; 8 | declare module '*.scss'; 9 | declare module '*.sass'; 10 | declare module '*.styl'; 11 | 12 | // @ts-ignore 13 | declare const process: { 14 | env: { 15 | TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq'; 16 | [key: string]: any; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /taro-next/src/app.ts: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import './app.css' 3 | 4 | // if (process.env.TARO_ENV === 'weapp') { 5 | // require('./utils/perf') 6 | // } 7 | class App extends Component { 8 | 9 | componentDidMount () {} 10 | 11 | componentDidShow () {} 12 | 13 | componentDidHide () {} 14 | 15 | componentDidCatchError () {} 16 | 17 | // this.props.children 是将要会渲染的页面 18 | render () { 19 | return this.props.children 20 | } 21 | } 22 | 23 | export default App 24 | -------------------------------------------------------------------------------- /wechat/components/card/card.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | /** 3 | * 组件的属性列表 4 | */ 5 | properties: { 6 | item: { 7 | type: Object, 8 | value: {}, 9 | } 10 | }, 11 | data: { 12 | isActive: false 13 | }, 14 | 15 | methods: { 16 | trigger() { 17 | this.$perf && this.$perf.mark('setData'); 18 | this.setData({ 19 | isActive: !this.data.isActive 20 | }) 21 | } 22 | } 23 | }) -------------------------------------------------------------------------------- /uni-app/README.md: -------------------------------------------------------------------------------- 1 | # uni-app 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /uni-app-v3/README.md: -------------------------------------------------------------------------------- 1 | # uni-app 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /kbone/build/webpack.perf.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | mode: 'production', 5 | entry: { 6 | // js 入口 7 | 'perf.common': path.resolve(__dirname, '../src/utils/perf.js'), 8 | }, 9 | output: { 10 | path: path.resolve(__dirname, '../src/utils'), 11 | filename: '[name].js', // 必需字段,不能修改 12 | }, 13 | optimization: { 14 | minimizer: [] 15 | }, 16 | module: { 17 | rules: [ 18 | // js 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /kbone/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | const Home = () => import(/* webpackChunkName: "Home" */'@/home/Index.vue') 5 | 6 | Vue.use(Router) 7 | 8 | export default new Router({ 9 | mode: 'history', 10 | routes: [{ 11 | path: '/(home|index)?', 12 | name: 'Home', 13 | component: Home, 14 | }, { 15 | path: '/index.html', 16 | name: 'HomeHtml', 17 | component: Home, 18 | }, { 19 | path: '/test/(home|index)', 20 | name: 'HomeTest', 21 | component: Home, 22 | }], 23 | }) 24 | -------------------------------------------------------------------------------- /mpvue/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | // var isProduction = process.env.NODE_ENV === 'production' 4 | // for mp 5 | var isProduction = true 6 | 7 | module.exports = { 8 | loaders: utils.cssLoaders({ 9 | sourceMap: isProduction 10 | ? config.build.productionSourceMap 11 | : config.dev.cssSourceMap, 12 | extract: isProduction 13 | }), 14 | transformToRequire: { 15 | video: 'src', 16 | source: 'src', 17 | img: 'src', 18 | image: 'xlink:href' 19 | }, 20 | fileExt: config.build.fileExt 21 | } 22 | -------------------------------------------------------------------------------- /mpvue/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": false, 6 | "postcss": true, 7 | "minified": true, 8 | "newFeature": true 9 | }, 10 | "miniprogramRoot": "dist/wx/", 11 | "compileType": "miniprogram", 12 | "appid": "wx9dcdaed5b2bc94ad", 13 | "projectname": "mpvue", 14 | "condition": { 15 | "search": { 16 | "current": -1, 17 | "list": [] 18 | }, 19 | "conversation": { 20 | "current": -1, 21 | "list": [] 22 | }, 23 | "game": { 24 | "currentL": -1, 25 | "list": [] 26 | }, 27 | "miniprogram": { 28 | "current": -1, 29 | "list": [] 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /mpvue/README.md: -------------------------------------------------------------------------------- 1 | # mpvue 2 | 3 | > A Mpvue project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # 初始化项目 9 | vue init mpvue/mpvue-quickstart myproject 10 | cd myproject 11 | 12 | # 安装依赖 13 | yarn 14 | 15 | # 开发时构建 16 | npm dev 17 | 18 | # 打包构建 19 | npm build 20 | 21 | # 指定平台的开发时构建(微信、百度、头条、支付宝) 22 | npm dev:wx 23 | npm dev:swan 24 | npm dev:tt 25 | npm dev:my 26 | 27 | # 指定平台的打包构建 28 | npm build:wx 29 | npm build:swan 30 | npm build:tt 31 | npm build:my 32 | 33 | # 生成 bundle 分析报告 34 | npm run build --report 35 | ``` 36 | 37 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 38 | -------------------------------------------------------------------------------- /wepy/src/app.wpy: -------------------------------------------------------------------------------- 1 | 11 | 12 | 32 | -------------------------------------------------------------------------------- /wechat/utils/interface.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 是否开始测算页面性能 3 | */ 4 | export function shouldMeasurePage(data) { 5 | return true 6 | } 7 | /** 8 | * 是否开始测试组件性能 9 | */ 10 | export function shouldMeasureComponent(data) { 11 | return this.$perf.count > 0 12 | } 13 | export function getComponentTriggerFn() { 14 | return function componentTrigger() { 15 | return this.trigger() 16 | } 17 | } 18 | /** 19 | * 显示 toast 20 | */ 21 | export function showToast(args) { 22 | return wx.showToast(args) 23 | } 24 | /** 25 | * 隐藏 toast 26 | */ 27 | export function hideToast() { 28 | return wx.hideToast() 29 | } 30 | /** 31 | * 显示 modal 32 | */ 33 | export function showModal(args) { 34 | return wx.showModal(args) 35 | } 36 | -------------------------------------------------------------------------------- /kbone/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "es2015", 5 | "lib": ["es2015", "es2017", "dom"], 6 | "noImplicitAny": false, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "outDir": "app", 10 | "baseUrl": ".", 11 | "allowSyntheticDefaultImports": true, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata":true, 14 | "esModuleInterop": true, 15 | "resolveJsonModule": true, 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/@types/*", 20 | "protobuf/@types/*" 21 | ], 22 | "@src/client/*":["src/client/*"] 23 | } 24 | }, 25 | "include": [ 26 | "src/**/*" 27 | ], 28 | "exclude": [ 29 | "./node_modules/*" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /chameleon/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 是否开始测算页面性能 4 | */ 5 | export function shouldMeasurePage (data) { 6 | return data.listData && data.listData.length > 0 7 | } 8 | /** 9 | * 是否开始测试组件性能 10 | */ 11 | export function shouldMeasureComponent (data) { 12 | return this.$perf.count > 0 13 | } 14 | export function getComponentTriggerFn () { 15 | return function componentTrigger () { 16 | return this.trigger() 17 | } 18 | } 19 | /** 20 | * 显示 toast 21 | */ 22 | export function showToast (args) { 23 | return wx.showToast(args) 24 | } 25 | /** 26 | * 隐藏 toast 27 | */ 28 | export function hideToast () { 29 | return wx.hideToast() 30 | } 31 | /** 32 | * 显示 modal 33 | */ 34 | export function showModal (args) { 35 | return wx.showModal(args) 36 | } 37 | -------------------------------------------------------------------------------- /chameleon/src/app/app.cml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | 25 | 28 | 29 | -------------------------------------------------------------------------------- /uni-app-v3/postcss.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | module.exports = { 3 | parser: require('postcss-comment'), 4 | plugins: [ 5 | require('postcss-import')({ 6 | resolve (id, basedir, importOptions) { 7 | if (id.startsWith('~@/')) { 8 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3)) 9 | } else if (id.startsWith('@/')) { 10 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2)) 11 | } else if (id.startsWith('/') && !id.startsWith('//')) { 12 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1)) 13 | } 14 | return id 15 | } 16 | }), 17 | require('autoprefixer')({ 18 | remove: process.env.UNI_PLATFORM !== 'h5' 19 | }), 20 | require('@dcloudio/vue-cli-plugin-uni/packages/postcss') 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /uni-app/postcss.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | module.exports = { 3 | parser: require('postcss-comment'), 4 | plugins: [ 5 | require('postcss-import')({ 6 | resolve (id, basedir, importOptions) { 7 | if (id.startsWith('~@/')) { 8 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3)) 9 | } else if (id.startsWith('@/')) { 10 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2)) 11 | } else if (id.startsWith('/') && !id.startsWith('//')) { 12 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1)) 13 | } 14 | return id 15 | } 16 | }), 17 | require('autoprefixer')({ 18 | remove: process.env.UNI_PLATFORM !== 'h5' 19 | }), 20 | require('@dcloudio/vue-cli-plugin-uni/packages/postcss') 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /taro-next/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "commonjs", 5 | "removeComments": false, 6 | "preserveConstEnums": true, 7 | "moduleResolution": "node", 8 | "experimentalDecorators": true, 9 | "noImplicitAny": false, 10 | "allowSyntheticDefaultImports": true, 11 | "outDir": "lib", 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "strictNullChecks": true, 15 | "sourceMap": true, 16 | "baseUrl": ".", 17 | "rootDir": ".", 18 | "jsx": "react", 19 | "jsxFactory": "React.createElement", 20 | "allowJs": true, 21 | "resolveJsonModule": true, 22 | "typeRoots": [ 23 | "node_modules/@types", 24 | "global.d.ts" 25 | ] 26 | }, 27 | "exclude": [ 28 | "node_modules", 29 | "dist" 30 | ], 31 | "compileOnSave": false 32 | } 33 | -------------------------------------------------------------------------------- /uni-app-v3/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | const { 2 | PERF_LIKE_MAX, 3 | } = require('./config') 4 | 5 | /** 6 | * 是否开始测算页面性能 7 | */ 8 | export function shouldMeasurePage (data) { 9 | return true 10 | } 11 | /** 12 | * 是否开始测试组件性能 13 | */ 14 | export function shouldMeasureComponent (data,perf) { 15 | return this.$perf.count > 0 16 | } 17 | export function getComponentTriggerFn () { 18 | console.log(`当前点击第${this.$perf.count}次,共${PERF_LIKE_MAX}次`) 19 | return function componentTrigger () { 20 | return this.$vm.trigger() 21 | } 22 | } 23 | /** 24 | * 显示 toast 25 | */ 26 | export function showToast (args) { 27 | return uni.showToast(args) 28 | } 29 | /** 30 | * 隐藏 toast 31 | */ 32 | export function hideToast () { 33 | return uni.hideToast() 34 | } 35 | /** 36 | * 显示 modal 37 | */ 38 | export function showModal (args) { 39 | return uni.showModal(args) 40 | } 41 | -------------------------------------------------------------------------------- /wechat/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件", 3 | "packOptions": { 4 | "ignore": [] 5 | }, 6 | "setting": { 7 | "urlCheck": false, 8 | "es6": true, 9 | "postcss": true, 10 | "minified": true, 11 | "newFeature": true, 12 | "autoAudits": false 13 | }, 14 | "compileType": "miniprogram", 15 | "libVersion": "2.10.3", 16 | "appid": "wx9dcdaed5b2bc94ad", 17 | "projectname": "wxchat", 18 | "debugOptions": { 19 | "hidedInDevtools": [] 20 | }, 21 | "isGameTourist": false, 22 | "simulatorType": "wechat", 23 | "simulatorPluginLibVersion": {}, 24 | "condition": { 25 | "search": { 26 | "current": -1, 27 | "list": [] 28 | }, 29 | "conversation": { 30 | "current": -1, 31 | "list": [] 32 | }, 33 | "game": { 34 | "currentL": -1, 35 | "list": [] 36 | }, 37 | "miniprogram": { 38 | "current": -1, 39 | "list": [] 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /wepy/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 是否开始测算页面性能 3 | */ 4 | export function shouldMeasurePage (data, autoArgs) { 5 | return data.listData && data.listData.length >= 20 6 | } 7 | /** 8 | * 是否开始测试组件性能 9 | */ 10 | export function shouldMeasureComponent (data) { 11 | return this.$perf.count > 0 12 | } 13 | /** 14 | * 获取组件 trigger 方法 15 | */ 16 | export function getComponentTriggerFn () { 17 | return function componentTrigger (args) { 18 | return this.$perf.$vm.methods.trigger.call(this.$perf.$vm, args) 19 | } 20 | } 21 | /** 22 | * 显示 toast 23 | */ 24 | export function showToast (args) { 25 | return wx.showToast(args) 26 | } 27 | /** 28 | * 隐藏 toast 29 | */ 30 | export function hideToast () { 31 | return wx.hideToast() 32 | } 33 | /** 34 | * 显示 modal 35 | */ 36 | export function showModal (args) { 37 | return wx.showModal(args) 38 | } 39 | -------------------------------------------------------------------------------- /uni-app/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | const { 2 | PERF_LIKE_MAX, 3 | } = require('./config') 4 | 5 | /** 6 | * 是否开始测算页面性能 7 | */ 8 | export function shouldMeasurePage (data) { 9 | return true 10 | } 11 | /** 12 | * 是否开始测试组件性能 13 | */ 14 | export function shouldMeasureComponent (data,perf) { 15 | return this.$perf.count > 0 16 | } 17 | export function getComponentTriggerFn () { 18 | console.log(`当前点击第${this.$perf.count}次,共${PERF_LIKE_MAX}次`) 19 | return function componentTrigger () { 20 | return this.$vm.trigger() 21 | } 22 | } 23 | /** 24 | * 显示 toast 25 | */ 26 | export function showToast (args) { 27 | return uni.showToast(args) 28 | } 29 | /** 30 | * 隐藏 toast 31 | */ 32 | export function hideToast () { 33 | return uni.hideToast() 34 | } 35 | /** 36 | * 显示 modal 37 | */ 38 | export function showModal (args) { 39 | return uni.showModal(args) 40 | } 41 | -------------------------------------------------------------------------------- /chameleon/chameleon.config.js: -------------------------------------------------------------------------------- 1 | 2 | // 设置静态资源的线上路径 3 | const publicPath = '//www.static.chameleon.com/cml'; 4 | // 设置api请求前缀 5 | const apiPrefix = 'https://api.chameleon.com'; 6 | 7 | cml.config.merge({ 8 | templateLang: "cml", 9 | templateType: "html", 10 | platforms: ["web","weex","wx"], 11 | buildInfo: { 12 | wxAppId: '' 13 | }, 14 | wx: { 15 | dev: { 16 | }, 17 | build: { 18 | apiPrefix 19 | } 20 | }, 21 | web: { 22 | dev: { 23 | analysis: false, 24 | console: false 25 | }, 26 | build: { 27 | analysis: false, 28 | publicPath: `${publicPath}/web/`, 29 | apiPrefix 30 | } 31 | }, 32 | weex: { 33 | dev: { 34 | }, 35 | build: { 36 | publicPath: `${publicPath}/weex/`, 37 | apiPrefix 38 | }, 39 | custom: { 40 | publicPath: `${publicPath}/wx/`, 41 | apiPrefix 42 | } 43 | } 44 | }) 45 | 46 | -------------------------------------------------------------------------------- /mpvue/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 是否开始测算页面性能 3 | */ 4 | export function shouldMeasurePage (data, autoArgs) { 5 | return !!data['$root.0.listData'] || Object.keys(data).length >= 20 6 | } 7 | /** 8 | * 是否开始测试组件性能 9 | */ 10 | export function shouldMeasureComponent (data) { 11 | return this.$perf.count > 0 && Object.keys(data).length > 1 12 | } 13 | /** 14 | * 获取组件 trigger 方法 15 | */ 16 | export function getComponentTriggerFn () { 17 | return function componentTrigger (args) { 18 | return this.$perf.$vm.trigger(args) 19 | } 20 | } 21 | /** 22 | * 显示 toast 23 | */ 24 | export function showToast (args) { 25 | return mpvue.showToast(args) 26 | } 27 | /** 28 | * 隐藏 toast 29 | */ 30 | export function hideToast () { 31 | return mpvue.hideToast() 32 | } 33 | /** 34 | * 显示 modal 35 | */ 36 | export function showModal (args) { 37 | return mpvue.showModal(args) 38 | } 39 | -------------------------------------------------------------------------------- /uniapp-vue3/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | // const { 2 | // PERF_LIKE_MAX, 3 | // } = require('./config') 4 | import {PERF_LIKE_MAX} from './config' 5 | 6 | /** 7 | * 是否开始测算页面性能 8 | */ 9 | export function shouldMeasurePage (data) { 10 | return true 11 | } 12 | /** 13 | * 是否开始测试组件性能 14 | */ 15 | export function shouldMeasureComponent (data,perf) { 16 | return this.$perf.count > 0 17 | } 18 | export function getComponentTriggerFn () { 19 | console.log(`当前点击第${this.$perf.count}次,共${PERF_LIKE_MAX}次`) 20 | return function componentTrigger () { 21 | return this.$vm.trigger() 22 | } 23 | } 24 | /** 25 | * 显示 toast 26 | */ 27 | export function showToast (args) { 28 | return uni.showToast(args) 29 | } 30 | /** 31 | * 隐藏 toast 32 | */ 33 | export function hideToast () { 34 | return uni.hideToast() 35 | } 36 | /** 37 | * 显示 modal 38 | */ 39 | export function showModal (args) { 40 | return uni.showModal(args) 41 | } 42 | -------------------------------------------------------------------------------- /mpvue/src/components/banner.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 23 | 24 | 48 | -------------------------------------------------------------------------------- /kbone/src/mp/home/main.mp.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import { sync } from 'vuex-router-sync' 4 | import App from '../../App.vue' 5 | import store from '../../store' 6 | import Home from '../../home/Index.vue' 7 | 8 | Vue.use(Router) 9 | import '../../utils/perf' 10 | 11 | 12 | const router = new Router({ 13 | mode: 'history', 14 | routes: [{ 15 | path: '/(home|index)?', 16 | name: 'Home', 17 | component: Home, 18 | }, { 19 | path: '/index.html', 20 | name: 'HomeHtml', 21 | component: Home, 22 | }, { 23 | path: '/test/(home|index)', 24 | name: 'HomeTest', 25 | component: Home, 26 | }], 27 | }) 28 | 29 | export default function createApp() { 30 | const container = document.createElement('div') 31 | container.id = 'app' 32 | document.body.appendChild(container) 33 | 34 | Vue.config.productionTip = false 35 | 36 | sync(store, router) 37 | 38 | return new Vue({ 39 | el: '#app', 40 | router, 41 | store, 42 | render: h => h(App) 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /taro-next/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | import Taro from '@tarojs/taro' 2 | 3 | const { 4 | PERF_LIKE_MAX, 5 | } = require('./config') 6 | /** 7 | * 是否开始测算页面性能 8 | */ 9 | export function shouldMeasurePage(data) { 10 | return Object.keys(data).length > 1 11 | } 12 | /** 13 | * 是否开始测试组件性能 14 | */ 15 | export function shouldMeasureComponent(data) { 16 | return this.$perf.count > 0 && Object.keys(data).length > 0 17 | } 18 | /** 19 | * 获取组件 trigger 方法 20 | */ 21 | export function getComponentTriggerFn(perf) { 22 | console.log(`当前点击第${perf.count}次,共${PERF_LIKE_MAX}次`) 23 | return function componentTrigger() { 24 | return perf.self.trigger() 25 | } 26 | } 27 | /** 28 | * 显示 toast 29 | */ 30 | export function showToast(args) { 31 | return Taro.showToast(args) 32 | } 33 | /** 34 | * 隐藏 toast 35 | */ 36 | export function hideToast() { 37 | return Taro.hideToast() 38 | } 39 | /** 40 | * 显示 modal 41 | */ 42 | export function showModal(args) { 43 | return Taro.showModal(args) 44 | } 45 | -------------------------------------------------------------------------------- /taro/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | import Taro from '@tarojs/taro' 2 | 3 | const { 4 | PERF_LIKE_MAX, 5 | } = require('./config') 6 | /** 7 | * 是否开始测算页面性能 8 | */ 9 | export function shouldMeasurePage(data) { 10 | return Object.keys(data).length > 1 11 | } 12 | /** 13 | * 是否开始测试组件性能 14 | */ 15 | export function shouldMeasureComponent(data) { 16 | return this.$perf.count > 0 && Object.keys(data).length > 0 17 | } 18 | /** 19 | * 获取组件 trigger 方法 20 | */ 21 | export function getComponentTriggerFn() { 22 | console.log(`当前点击第${this.$perf.count}次,共${PERF_LIKE_MAX}次`) 23 | return function componentTrigger() { 24 | return this.$component.trigger() 25 | } 26 | } 27 | /** 28 | * 显示 toast 29 | */ 30 | export function showToast(args) { 31 | return Taro.showToast(args) 32 | } 33 | /** 34 | * 隐藏 toast 35 | */ 36 | export function hideToast() { 37 | return Taro.hideToast() 38 | } 39 | /** 40 | * 显示 modal 41 | */ 42 | export function showModal(args) { 43 | return Taro.showModal(args) 44 | } 45 | -------------------------------------------------------------------------------- /taro/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /taro-next/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /wechat/pages/index/index.js: -------------------------------------------------------------------------------- 1 | import Api from "../../utils/api.js"; 2 | Page({ 3 | data: { 4 | listData: [] 5 | }, 6 | onLoad() { 7 | this.$perf && this.$perf.mark('setData'); 8 | this.setData({ 9 | listData: Api.getNews() 10 | }) 11 | 12 | }, 13 | onPullDownRefresh() { 14 | this.listData = Api.getNews(); 15 | setTimeout(() => { 16 | wx.stopPullDownRefresh(); 17 | }, 1000); 18 | }, 19 | onReachBottom() { 20 | // 数据全量更新 21 | this.$perf && this.$perf.mark('setData'); 22 | let listData = this.data.listData; 23 | listData.push(...Api.getNews()); 24 | this.setData({ 25 | listData 26 | }) 27 | 28 | // 数据差量更新 29 | // this.$perf && this.$perf.mark('setData'); 30 | // // 通过长度获取下一次渲染的索引 31 | // let count = this.data.listData.length; 32 | // let data = {}; 33 | // Api.getNews().forEach((item) => { 34 | // data['listData[' + (count++) + ']'] = item 35 | // }) 36 | // this.setData(data) 37 | } 38 | }) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 DCloud 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /kbone/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 wechat-miniprogram 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /kbone/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # others 64 | .idea 65 | .DS_Store 66 | package-lock.json 67 | dist 68 | -------------------------------------------------------------------------------- /uni-app-v3/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 17 | 18 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /kbone/src/utils/interface.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable max-len */ 2 | /* eslint-disable no-undef */ 3 | const { 4 | PERF_LIKE_MAX, 5 | } = require('./config') 6 | 7 | /** 8 | * 是否开始测算页面性能 9 | */ 10 | // export function shouldMeasurePage() { 11 | // return true 12 | // } 13 | 14 | export function shouldMeasurePage(data) { 15 | const isPage = data.childNodes && data.childNodes[0] && data.childNodes[0].childNodes[0].childNodes[0].childNodes 16 | if ((Object.keys(data).length === 1 && data.pageId) || !(isPage && isPage.length > 0)) { 17 | return false 18 | } 19 | return true 20 | } 21 | 22 | /** 23 | * 是否开始测试组件性能 24 | */ 25 | export function shouldMeasureComponent(data, perf) { 26 | return perf.count > 0 27 | } 28 | export function getComponentTriggerFn(perf) { 29 | console.log(`当前点击第${perf.count}次,共${PERF_LIKE_MAX}次`) 30 | return function componentTrigger() { 31 | return perf.self.trigger() 32 | } 33 | } 34 | /** 35 | * 显示 toast 36 | */ 37 | export function showToast(args) { 38 | return wx.showToast(args) 39 | } 40 | /** 41 | * 隐藏 toast 42 | */ 43 | export function hideToast() { 44 | return wx.hideToast() 45 | } 46 | /** 47 | * 显示 modal 48 | */ 49 | export function showModal(args) { 50 | return wx.showModal(args) 51 | } 52 | -------------------------------------------------------------------------------- /uni-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 17 | 18 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /wepy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wepy", 3 | "version": "0.0.2", 4 | "description": "A WePY project", 5 | "main": "dist/app.js", 6 | "scripts": { 7 | "dev": "wepy build --watch", 8 | "build": "cross-env NODE_ENV=production wepy build --no-cache", 9 | "dev:web": "wepy build --output web", 10 | "clean": "find ./dist -maxdepth 1 -not -name 'project.config.json' -not -name 'dist' | xargs rm -rf", 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "wepy": { 14 | "module-a": false, 15 | "./src/components/list": "./src/components/wepy-list.wpy" 16 | }, 17 | "author": "mehaotian <490272692@qq.com>", 18 | "license": "MIT", 19 | "dependencies": { 20 | "wepy": "^1.6.0", 21 | "wepy-async-function": "^1.4.4", 22 | "wepy-com-toast": "^1.0.2" 23 | }, 24 | "devDependencies": { 25 | "babel-eslint": "^7.2.1", 26 | "babel-plugin-transform-class-properties": "^6.24.1", 27 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 28 | "babel-plugin-transform-export-extensions": "^6.22.0", 29 | "babel-plugin-transform-object-rest-spread": "^6.26.0", 30 | "babel-preset-env": "^1.6.1", 31 | "cross-env": "^5.1.3", 32 | "less": "^3.8.1", 33 | "wepy-compiler-babel": "^1.5.1", 34 | "wepy-compiler-less": "^1.3.10" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /taro/src/app.jsx: -------------------------------------------------------------------------------- 1 | import Taro, { Component } from '@tarojs/taro' 2 | import Index from './pages/index' 3 | import './app.css' 4 | 5 | if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'alipay') { 6 | require('./utils/perf') 7 | } 8 | // 如果需要在 h5 环境中开启 React Devtools 9 | // 取消以下注释: 10 | // if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') { 11 | // require('nerv-devtools') 12 | // } 13 | 14 | class App extends Component { 15 | 16 | 17 | componentDidMount() { } 18 | 19 | componentDidShow() { } 20 | 21 | componentDidHide() { } 22 | 23 | componentDidCatchError() { } 24 | /** 25 | * 指定config的类型声明为: Taro.Config 26 | * 27 | * 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型 28 | * 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string 29 | * 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型 30 | */ 31 | config = { 32 | pages: [ 33 | 'pages/index/index' 34 | ], 35 | window: { 36 | backgroundTextStyle: 'light', 37 | navigationBarBackgroundColor: '#fff', 38 | navigationBarTitleText: '仿微博 - taro版', 39 | navigationBarTextStyle: 'black' 40 | } 41 | } 42 | 43 | // 在 App 类中的 render() 函数没有实际作用 44 | // 请勿修改此函数 45 | render() { 46 | return ( 47 | 48 | ) 49 | } 50 | } 51 | 52 | Taro.render(, document.getElementById('app')) 53 | -------------------------------------------------------------------------------- /mpvue/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | process.env.PLATFORM = process.argv[process.argv.length - 1] || 'wx' 5 | 6 | var ora = require('ora') 7 | var rm = require('rimraf') 8 | var path = require('path') 9 | var chalk = require('chalk') 10 | var webpack = require('webpack') 11 | var config = require('../config') 12 | var webpackConfig = require('./webpack.prod.conf') 13 | var utils = require('./utils') 14 | 15 | var spinner = ora('building for production...') 16 | spinner.start() 17 | 18 | rm(path.join(config.build.assetsRoot, '*'), err => { 19 | if (err) throw err 20 | webpack(webpackConfig, function (err, stats) { 21 | spinner.stop() 22 | if (err) throw err 23 | if (process.env.PLATFORM === 'swan') { 24 | utils.writeFrameworkinfo() 25 | } 26 | process.stdout.write(stats.toString({ 27 | colors: true, 28 | modules: false, 29 | children: false, 30 | chunks: false, 31 | chunkModules: false 32 | }) + '\n\n') 33 | 34 | if (stats.hasErrors()) { 35 | console.log(chalk.red(' Build failed with errors.\n')) 36 | process.exit(1) 37 | } 38 | 39 | console.log(chalk.cyan(' Build complete.\n')) 40 | console.log(chalk.yellow( 41 | ' Tip: built files are meant to be served over an HTTP server.\n' + 42 | ' Opening index.html over file:// won\'t work.\n' 43 | )) 44 | }) 45 | }) 46 | -------------------------------------------------------------------------------- /mpvue/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | } 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /kbone/build/miniprogram.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 配置参考:https://wechat-miniprogram.github.io/kbone/docs/config/ 3 | */ 4 | 5 | const path = require('path') 6 | module.exports = { 7 | origin: 'https://test.miniprogram.com', 8 | entry: '/', 9 | router: { 10 | home: [ 11 | '/(home|index)?', 12 | '/index.html', 13 | '/test/(home|index)', 14 | ] 15 | }, 16 | redirect: { 17 | notFound: 'home', 18 | accessDenied: 'home', 19 | }, 20 | generate: { 21 | autoBuildNpm: 'npm', 22 | }, 23 | app: { 24 | backgroundTextStyle: 'dark', 25 | navigationBarTextStyle: 'white', 26 | navigationBarTitleText: 'kbone 仿微博', 27 | }, 28 | appExtraConfig: { 29 | sitemapLocation: 'sitemap.json', 30 | }, 31 | global: { 32 | share: true, 33 | windowScroll: false, 34 | backgroundColor: '#F7F7F7', 35 | reachBottom: true 36 | }, 37 | pages: { 38 | home: { 39 | navigationBarTitleText: '123' 40 | } 41 | }, 42 | optimization: { 43 | domSubTreeLevel: 10, 44 | 45 | elementMultiplexing: true, 46 | textMultiplexing: true, 47 | commentMultiplexing: true, 48 | domExtendMultiplexing: true, 49 | 50 | styleValueReduce: 5000, 51 | attrValueReduce: 5000, 52 | }, 53 | projectConfig: { 54 | projectname: 'kbone-template-vue', 55 | appid: '', 56 | }, 57 | } 58 | -------------------------------------------------------------------------------- /wepy/wepy.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | var prod = process.env.NODE_ENV === 'production'; 3 | 4 | module.exports = { 5 | wpyExt: '.wpy', 6 | eslint: false, 7 | cliLogs: !prod, 8 | build: { 9 | }, 10 | resolve: { 11 | alias: { 12 | counter: path.join(__dirname, 'src/components/counter'), 13 | '@': path.join(__dirname, 'src') 14 | }, 15 | aliasFields: ['wepy', 'weapp'], 16 | modules: ['node_modules'] 17 | }, 18 | compilers: { 19 | less: { 20 | compress: prod 21 | }, 22 | /*sass: { 23 | outputStyle: 'compressed' 24 | },*/ 25 | babel: { 26 | sourceMap: true, 27 | presets: [ 28 | 'env' 29 | ], 30 | plugins: [ 31 | 'transform-class-properties', 32 | 'transform-decorators-legacy', 33 | 'transform-object-rest-spread', 34 | 'transform-export-extensions', 35 | ] 36 | } 37 | }, 38 | plugins: { 39 | }, 40 | appConfig: { 41 | noPromiseAPI: ['createSelectorQuery'] 42 | } 43 | } 44 | 45 | if (prod) { 46 | 47 | // 压缩sass 48 | // module.exports.compilers['sass'] = {outputStyle: 'compressed'} 49 | 50 | // 压缩js 51 | module.exports.plugins = { 52 | uglifyjs: { 53 | filter: /\.js$/, 54 | config: { 55 | } 56 | }, 57 | imagemin: { 58 | filter: /\.(jpg|png|jpeg)$/, 59 | config: { 60 | jpg: { 61 | quality: 80 62 | }, 63 | png: { 64 | quality: 80 65 | } 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /uni-app-v3/babel.config.js: -------------------------------------------------------------------------------- 1 | const plugins = [] 2 | 3 | if (process.env.UNI_OPT_TREESHAKINGNG) { 4 | plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js')) 5 | } 6 | 7 | if ( 8 | ( 9 | process.env.UNI_PLATFORM === 'app-plus' && 10 | process.env.UNI_USING_V8 11 | ) || 12 | ( 13 | process.env.UNI_PLATFORM === 'h5' && 14 | process.env.UNI_H5_BROWSER === 'builtin' 15 | ) 16 | ) { 17 | const path = require('path') 18 | 19 | const isWin = /^win/.test(process.platform) 20 | 21 | const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path) 22 | 23 | const input = normalizePath(process.env.UNI_INPUT_DIR) 24 | try { 25 | plugins.push([ 26 | require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'), 27 | { 28 | file (file) { 29 | file = normalizePath(file) 30 | if (file.indexOf(input) === 0) { 31 | return path.relative(input, file) 32 | } 33 | return false 34 | } 35 | } 36 | ]) 37 | } catch (e) {} 38 | } 39 | 40 | process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui'] 41 | process.UNI_LIBRARIES.forEach(libraryName => { 42 | plugins.push([ 43 | 'import', 44 | { 45 | 'libraryName': libraryName, 46 | 'customName': (name) => { 47 | return `${libraryName}/lib/${name}/${name}` 48 | } 49 | } 50 | ]) 51 | }) 52 | module.exports = { 53 | presets: [ 54 | [ 55 | '@vue/app', 56 | { 57 | // modules: 'commonjs', 58 | useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry' 59 | } 60 | ] 61 | ], 62 | plugins 63 | } 64 | -------------------------------------------------------------------------------- /taro-next/config/index.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | projectName: 'taro-next', 3 | date: '2020-4-3', 4 | designWidth: 750, 5 | deviceRatio: { 6 | 640: 2.34 / 2, 7 | 750: 1, 8 | 828: 1.81 / 2 9 | }, 10 | sourceRoot: 'src', 11 | outputRoot: 'dist', 12 | plugins: [], 13 | defineConstants: { 14 | }, 15 | copy: { 16 | patterns: [ 17 | ], 18 | options: { 19 | } 20 | }, 21 | framework: 'react', 22 | mini: { 23 | postcss: { 24 | pxtransform: { 25 | enable: true, 26 | config: { 27 | 28 | } 29 | }, 30 | url: { 31 | enable: true, 32 | config: { 33 | limit: 1024 // 设定转换尺寸上限 34 | } 35 | }, 36 | cssModules: { 37 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true 38 | config: { 39 | namingPattern: 'module', // 转换模式,取值为 global/module 40 | generateScopedName: '[name]__[local]___[hash:base64:5]' 41 | } 42 | } 43 | } 44 | }, 45 | h5: { 46 | publicPath: '/', 47 | staticDirectory: 'static', 48 | postcss: { 49 | autoprefixer: { 50 | enable: true, 51 | config: { 52 | } 53 | }, 54 | cssModules: { 55 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true 56 | config: { 57 | namingPattern: 'module', // 转换模式,取值为 global/module 58 | generateScopedName: '[name]__[local]___[hash:base64:5]' 59 | } 60 | } 61 | } 62 | } 63 | } 64 | 65 | module.exports = function (merge) { 66 | if (process.env.NODE_ENV === 'development') { 67 | return merge({}, config, require('./dev')) 68 | } 69 | return merge({}, config, require('./prod')) 70 | } 71 | -------------------------------------------------------------------------------- /wechat/components/card/card.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.author_name}} 8 | {{item.published_at}} {{item.form}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | {{item.content}} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {{item.share}}万 29 | 30 | 31 | 32 | {{item.comment}}万 33 | 34 | 35 | 36 | {{item.thumbs}}万 37 | 38 | 39 | -------------------------------------------------------------------------------- /uni-app/src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 56 | 57 | 67 | -------------------------------------------------------------------------------- /uni-app/babel.config.js: -------------------------------------------------------------------------------- 1 | const plugins = [] 2 | 3 | if (process.env.UNI_OPT_TREESHAKINGNG) { 4 | plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js')) 5 | } 6 | 7 | if ( 8 | ( 9 | process.env.UNI_PLATFORM === 'app-plus' && 10 | process.env.UNI_USING_V8 11 | ) || 12 | ( 13 | process.env.UNI_PLATFORM === 'h5' && 14 | process.env.UNI_H5_BROWSER === 'builtin' 15 | ) 16 | ) { 17 | const path = require('path') 18 | 19 | const isWin = /^win/.test(process.platform) 20 | 21 | const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path) 22 | 23 | const input = normalizePath(process.env.UNI_INPUT_DIR) 24 | try { 25 | plugins.push([ 26 | require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'), 27 | { 28 | file (file) { 29 | file = normalizePath(file) 30 | if (file.indexOf(input) === 0) { 31 | return path.relative(input, file) 32 | } 33 | return false 34 | } 35 | } 36 | ]) 37 | } catch (e) {} 38 | } 39 | 40 | process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui'] 41 | process.UNI_LIBRARIES.forEach(libraryName => { 42 | plugins.push([ 43 | 'import', 44 | { 45 | 'libraryName': libraryName, 46 | 'customName': (name) => { 47 | return `${libraryName}/lib/${name}/${name}` 48 | } 49 | } 50 | ]) 51 | }) 52 | module.exports = { 53 | presets: [ 54 | [ 55 | '@vue/app', 56 | { 57 | modules: 'commonjs', 58 | useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry' 59 | } 60 | ] 61 | ], 62 | plugins 63 | } 64 | -------------------------------------------------------------------------------- /taro-next/src/pages/index/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import Taro from '@tarojs/taro' 3 | import { View } from '@tarojs/components' 4 | import Card from '../../components/card/card' 5 | import Api from '../../utils/api' 6 | 7 | import './index.css' 8 | 9 | 10 | export default class Index extends Component { 11 | constructor(props) { 12 | super(props) 13 | this.state = { 14 | listData: [] 15 | } 16 | } 17 | componentWillMount= () => { 18 | let pages = getCurrentPages() 19 | pages = pages[pages.length -1] 20 | if (process.env.TARO_ENV === 'weapp') { 21 | pages.$perf && pages.$perf.mark('setData') 22 | } 23 | 24 | this.setState({ 25 | listData: Api.getNews() 26 | }) 27 | } 28 | 29 | onPullDownRefresh() { 30 | this.setState({ 31 | listData: Api.getNews() 32 | }) 33 | setTimeout(() => { 34 | Taro.stopPullDownRefresh() 35 | Taro.showToast({ 36 | title: '刷新成功', 37 | duration: 1000 38 | }) 39 | }, 1000) 40 | } 41 | 42 | onReachBottom() { 43 | let pages = getCurrentPages() 44 | pages = pages[pages.length -1] 45 | pages.$perf && pages.$perf.mark('setData') 46 | let listData = this.state.listData 47 | listData.push(...Api.getNews()) 48 | this.setState({ 49 | listData 50 | }) 51 | } 52 | 53 | render() { 54 | const list = this.state.listData.map((item,index) => { 55 | return ( 56 | 57 | 58 | 59 | 60 | 61 | ) 62 | }) 63 | 64 | return ( 65 | 66 | {list} 67 | 68 | ) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /chameleon/src/pages/index/index.cml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 51 | 63 | 78 | -------------------------------------------------------------------------------- /taro/src/pages/index/index.jsx: -------------------------------------------------------------------------------- 1 | import Taro, { Component } from '@tarojs/taro' 2 | import { View } from '@tarojs/components' 3 | import Card from '../../components/card/card' 4 | import Api from '../../utils/api' 5 | 6 | import './index.css' 7 | 8 | export default class Index extends Component { 9 | 10 | constructor(props) { 11 | super(props) 12 | this.state = { 13 | listData: [] 14 | } 15 | } 16 | componentWillMount() { 17 | if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'alipay') { 18 | this.$scope && this.$scope.$perf && this.$scope.$perf.mark('setData') 19 | } 20 | 21 | this.setState({ 22 | listData: Api.getNews() 23 | }) 24 | } 25 | 26 | onPullDownRefresh() { 27 | this.setState({ 28 | listData: Api.getNews() 29 | }) 30 | setTimeout(() => { 31 | Taro.stopPullDownRefresh() 32 | Taro.showToast({ 33 | title: '刷新成功', 34 | duration: 1000 35 | }) 36 | }, 1000) 37 | } 38 | 39 | onReachBottom() { 40 | this.$scope && this.$scope.$perf && this.$scope.$perf.mark('setData') 41 | let listData = this.state.listData 42 | listData.push(...Api.getNews()) 43 | this.setState({ 44 | listData 45 | }) 46 | } 47 | config = { 48 | navigationBarTitleText: '仿微博 - taro版', 49 | enablePullDownRefresh: true, 50 | backgroundTextStyle: 'dark' 51 | } 52 | 53 | 54 | render() { 55 | const list = this.state.listData.map((item) => { 56 | return ( 57 | 58 | 59 | 60 | 61 | 62 | ) 63 | }) 64 | 65 | return ( 66 | 67 | {list} 68 | 69 | ) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /wepy/src/pages/index.wpy: -------------------------------------------------------------------------------- 1 | 11 | 34 | 35 | 76 | -------------------------------------------------------------------------------- /mpvue/src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 49 | 50 | 60 | -------------------------------------------------------------------------------- /uni-app-v3/src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 55 | 56 | 66 | -------------------------------------------------------------------------------- /uni-app-v3/src/uni.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 这里是uni-app内置的常用样式变量 3 | * 4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App 6 | * 7 | */ 8 | 9 | /** 10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 11 | * 12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 13 | */ 14 | 15 | /* 颜色变量 */ 16 | 17 | /* 行为相关颜色 */ 18 | $uni-color-primary: #007aff; 19 | $uni-color-success: #4cd964; 20 | $uni-color-warning: #f0ad4e; 21 | $uni-color-error: #dd524d; 22 | 23 | /* 文字基本颜色 */ 24 | $uni-text-color:#333;//基本色 25 | $uni-text-color-inverse:#fff;//反色 26 | $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 27 | $uni-text-color-placeholder: #808080; 28 | $uni-text-color-disable:#c0c0c0; 29 | 30 | /* 背景颜色 */ 31 | $uni-bg-color:#ffffff; 32 | $uni-bg-color-grey:#f8f8f8; 33 | $uni-bg-color-hover:#f1f1f1;//点击状态颜色 34 | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 35 | 36 | /* 边框颜色 */ 37 | $uni-border-color:#c8c7cc; 38 | 39 | /* 尺寸变量 */ 40 | 41 | /* 文字尺寸 */ 42 | $uni-font-size-sm:24upx; 43 | $uni-font-size-base:28upx; 44 | $uni-font-size-lg:32upx; 45 | 46 | /* 图片尺寸 */ 47 | $uni-img-size-sm:40upx; 48 | $uni-img-size-base:52upx; 49 | $uni-img-size-lg:80upx; 50 | 51 | /* Border Radius */ 52 | $uni-border-radius-sm: 4upx; 53 | $uni-border-radius-base: 6upx; 54 | $uni-border-radius-lg: 12upx; 55 | $uni-border-radius-circle: 50%; 56 | 57 | /* 水平间距 */ 58 | $uni-spacing-row-sm: 10px; 59 | $uni-spacing-row-base: 20upx; 60 | $uni-spacing-row-lg: 30upx; 61 | 62 | /* 垂直间距 */ 63 | $uni-spacing-col-sm: 8upx; 64 | $uni-spacing-col-base: 16upx; 65 | $uni-spacing-col-lg: 24upx; 66 | 67 | /* 透明度 */ 68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 69 | 70 | /* 文章场景相关 */ 71 | $uni-color-title: #2C405A; // 文章标题颜色 72 | $uni-font-size-title:40upx; 73 | $uni-color-subtitle: #555555; // 二级标题颜色 74 | $uni-font-size-subtitle:36upx; 75 | $uni-color-paragraph: #3F536E; // 文章段落颜色 76 | $uni-font-size-paragraph:30upx; -------------------------------------------------------------------------------- /uni-app/src/uni.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 这里是uni-app内置的常用样式变量 3 | * 4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App 6 | * 7 | */ 8 | 9 | /** 10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 11 | * 12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 13 | */ 14 | 15 | /* 颜色变量 */ 16 | 17 | /* 行为相关颜色 */ 18 | $uni-color-primary: #007aff; 19 | $uni-color-success: #4cd964; 20 | $uni-color-warning: #f0ad4e; 21 | $uni-color-error: #dd524d; 22 | 23 | /* 文字基本颜色 */ 24 | $uni-text-color:#333;//基本色 25 | $uni-text-color-inverse:#fff;//反色 26 | $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 27 | $uni-text-color-placeholder: #808080; 28 | $uni-text-color-disable:#c0c0c0; 29 | 30 | /* 背景颜色 */ 31 | $uni-bg-color:#ffffff; 32 | $uni-bg-color-grey:#f8f8f8; 33 | $uni-bg-color-hover:#f1f1f1;//点击状态颜色 34 | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 35 | 36 | /* 边框颜色 */ 37 | $uni-border-color:#c8c7cc; 38 | 39 | /* 尺寸变量 */ 40 | 41 | /* 文字尺寸 */ 42 | $uni-font-size-sm:24upx; 43 | $uni-font-size-base:28upx; 44 | $uni-font-size-lg:32upx; 45 | 46 | /* 图片尺寸 */ 47 | $uni-img-size-sm:40upx; 48 | $uni-img-size-base:52upx; 49 | $uni-img-size-lg:80upx; 50 | 51 | /* Border Radius */ 52 | $uni-border-radius-sm: 4upx; 53 | $uni-border-radius-base: 6upx; 54 | $uni-border-radius-lg: 12upx; 55 | $uni-border-radius-circle: 50%; 56 | 57 | /* 水平间距 */ 58 | $uni-spacing-row-sm: 10px; 59 | $uni-spacing-row-base: 20upx; 60 | $uni-spacing-row-lg: 30upx; 61 | 62 | /* 垂直间距 */ 63 | $uni-spacing-col-sm: 8upx; 64 | $uni-spacing-col-base: 16upx; 65 | $uni-spacing-col-lg: 24upx; 66 | 67 | /* 透明度 */ 68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 69 | 70 | /* 文章场景相关 */ 71 | $uni-color-title: #2C405A; // 文章标题颜色 72 | $uni-font-size-title:40upx; 73 | $uni-color-subtitle: #555555; // 二级标题颜色 74 | $uni-font-size-subtitle:36upx; 75 | $uni-color-paragraph: #3F536E; // 文章段落颜色 76 | $uni-font-size-paragraph:30upx; -------------------------------------------------------------------------------- /kbone/src/home/Index.vue: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-expressions */ 2 | /* eslint-disable no-unused-expressions */ 3 | 14 | 15 | 65 | 66 | 76 | -------------------------------------------------------------------------------- /uniapp-vue3/src/uni.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 这里是uni-app内置的常用样式变量 3 | * 4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App 6 | * 7 | */ 8 | 9 | /** 10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 11 | * 12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 13 | */ 14 | 15 | /* 颜色变量 */ 16 | 17 | /* 行为相关颜色 */ 18 | $uni-color-primary: #007aff; 19 | $uni-color-success: #4cd964; 20 | $uni-color-warning: #f0ad4e; 21 | $uni-color-error: #dd524d; 22 | 23 | /* 文字基本颜色 */ 24 | $uni-text-color:#333;//基本色 25 | $uni-text-color-inverse:#fff;//反色 26 | $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 27 | $uni-text-color-placeholder: #808080; 28 | $uni-text-color-disable:#c0c0c0; 29 | 30 | /* 背景颜色 */ 31 | $uni-bg-color:#ffffff; 32 | $uni-bg-color-grey:#f8f8f8; 33 | $uni-bg-color-hover:#f1f1f1;//点击状态颜色 34 | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 35 | 36 | /* 边框颜色 */ 37 | $uni-border-color:#c8c7cc; 38 | 39 | /* 尺寸变量 */ 40 | 41 | /* 文字尺寸 */ 42 | $uni-font-size-sm:24rpx; 43 | $uni-font-size-base:28rpx; 44 | $uni-font-size-lg:32rpx; 45 | 46 | /* 图片尺寸 */ 47 | $uni-img-size-sm:40rpx; 48 | $uni-img-size-base:52rpx; 49 | $uni-img-size-lg:80rpx; 50 | 51 | /* Border Radius */ 52 | $uni-border-radius-sm: 4rpx; 53 | $uni-border-radius-base: 6rpx; 54 | $uni-border-radius-lg: 12rpx; 55 | $uni-border-radius-circle: 50%; 56 | 57 | /* 水平间距 */ 58 | $uni-spacing-row-sm: 10px; 59 | $uni-spacing-row-base: 20rpx; 60 | $uni-spacing-row-lg: 30rpx; 61 | 62 | /* 垂直间距 */ 63 | $uni-spacing-col-sm: 8rpx; 64 | $uni-spacing-col-base: 16rpx; 65 | $uni-spacing-col-lg: 24rpx; 66 | 67 | /* 透明度 */ 68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 69 | 70 | /* 文章场景相关 */ 71 | $uni-color-title: #2C405A; // 文章标题颜色 72 | $uni-font-size-title:40rpx; 73 | $uni-color-subtitle: #555555; // 二级标题颜色 74 | $uni-font-size-subtitle:36rpx; 75 | $uni-color-paragraph: #3F536E; // 文章段落颜色 76 | $uni-font-size-paragraph:30rpx; -------------------------------------------------------------------------------- /kbone/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 12 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 13 | extends: ['plugin:vue/essential', 'airbnb-base'], 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'vue' 17 | ], 18 | // check if imports actually resolve 19 | settings: { 20 | 'import/resolver': { 21 | webpack: { 22 | config: 'build/webpack.base.config.js' 23 | } 24 | } 25 | }, 26 | rules: { 27 | // disallow reassignment of function parameters 28 | // disallow parameter object manipulation except for specific exclusions 29 | 'no-param-reassign': ['error', { 30 | props: true, 31 | ignorePropertyModificationsFor: [ 32 | 'state', // for vuex state 33 | 'acc', // for reduce accumulators 34 | 'e' // for e.returnvalue 35 | ] 36 | }], 37 | // allow optionalDependencies 38 | 'import/no-extraneous-dependencies': ['error', { 39 | optionalDependencies: ['test/unit/index.js'] 40 | }], 41 | // allow debugger during development 42 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 43 | // others 44 | 'no-console': 'off', 45 | 'semi': [ 46 | 'error', 47 | 'never' 48 | ], 49 | 'no-new': 'off', 50 | 'comma-dangle': [ 51 | 'error', 52 | 'only-multiline' 53 | ], 54 | 'import/no-webpack-loader-syntax': 'off', 55 | 'import/first': 'off', 56 | 'linebreak-style': ['off', 'windows'], 57 | }, 58 | 'globals': { 59 | 'window': true, 60 | 'document': true, 61 | 'App': true, 62 | 'Page': true, 63 | 'Component': true, 64 | 'Behavior': true, 65 | 'wx': true, 66 | 'getCurrentPages': true, 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /taro-next/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "taro-next", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "taro 性能测试", 6 | "templateInfo": { 7 | "name": "default", 8 | "typescript": true, 9 | "css": "none" 10 | }, 11 | "scripts": { 12 | "build:weapp": "taro build --type weapp", 13 | "build:swan": "taro build --type swan", 14 | "build:alipay": "taro build --type alipay", 15 | "build:tt": "taro build --type tt", 16 | "build:h5": "taro build --type h5", 17 | "build:rn": "taro build --type rn", 18 | "build:qq": "taro build --type qq", 19 | "build:quickapp": "taro build --type quickapp", 20 | "dev:weapp": "npm run build:weapp -- --watch", 21 | "dev:swan": "npm run build:swan -- --watch", 22 | "dev:alipay": "npm run build:alipay -- --watch", 23 | "dev:tt": "npm run build:tt -- --watch", 24 | "dev:h5": "npm run build:h5 -- --watch", 25 | "dev:rn": "npm run build:rn -- --watch", 26 | "dev:qq": "npm run build:qq -- --watch", 27 | "dev:quickapp": "npm run build:quickapp -- --watch" 28 | }, 29 | "browserslist": [ 30 | "last 3 versions", 31 | "Android >= 4.1", 32 | "ios >= 8" 33 | ], 34 | "author": "", 35 | "dependencies": { 36 | "@babel/runtime": "^7.7.7", 37 | "@tarojs/components": "3.0.0-beta.2", 38 | "@tarojs/runtime": "3.0.0-beta.2", 39 | "@tarojs/taro": "3.0.0-beta.2", 40 | "@tarojs/react": "3.0.0-beta.2", 41 | "react-dom": "^16.10.0", 42 | "react": "^16.10.0" 43 | }, 44 | "devDependencies": { 45 | "@types/webpack-env": "^1.13.6", 46 | "@types/react": "^16.0.0", 47 | "@tarojs/mini-runner": "3.0.0-beta.2", 48 | "@babel/core": "^7.8.0", 49 | "@tarojs/webpack-runner": "3.0.0-beta.2", 50 | "babel-preset-taro": "3.0.0-beta.2", 51 | "eslint-config-taro": "3.0.0-beta.2", 52 | "eslint": "^6.8.0", 53 | "eslint-plugin-react": "^7.8.2", 54 | "eslint-plugin-import": "^2.12.0", 55 | "eslint-plugin-react-hooks": "^1.6.1", 56 | "stylelint": "9.3.0", 57 | "@typescript-eslint/parser": "^2.x", 58 | "@typescript-eslint/eslint-plugin": "^2.x", 59 | "typescript": "^3.7.0" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /kbone/README.md: -------------------------------------------------------------------------------- 1 | # vue-kbone 2 | 3 | 使用 vue 多端开发(小程序和Web),基于 [kbone](https://github.com/wechat-miniprogram/kbone) 的 element 和 render。 4 | 5 | ## 特性 6 | 7 | * 一键接入,立即使用 8 | * 支持更完整的 vue 语法及特性 9 | * webpack、es6、babel、hot reload、cli、vue-router、vuex,你想要的都有 10 | 11 | ## 开发 12 | 13 | * Web 端:直接浏览器访问 localhost:8080/ 即可看到效果。 14 | 15 | ``` 16 | npm run web 17 | ``` 18 | 19 | * 小程序端:使用开发者工具打开 dist/mp 目录即可。 20 | 21 | ``` 22 | npm run mp 23 | ``` 24 | 25 | ## 构建 26 | 27 | * Web 端:构建完成会生成 dist/web 目录 28 | 29 | ``` 30 | npm run build 31 | ``` 32 | 33 | * 小程序端:构建完成会生成 dist/mp 目录 34 | 35 | ``` 36 | npm run build:mp 37 | ``` 38 | 39 | ## 小程序端打开 40 | 41 | 需要先进入 dist/mp 目录执行 `npm install` 安装相关的依赖包,然后用开发者工具打开 dist/mp 目录后再进行 npm 构建(关于 npm 构建可[点此查看官方文档](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html))。 42 | 43 | ## 目录说明 44 | 45 | 此模板 Web 端使用单入口,通过 vue-router + 动态 import 的方式来运行;小程序端则按照业务分拆成多个页面,同属一个业务的页面则通过 vue-router 来组织。 46 | 47 | ``` 48 | ├─ build 49 | │ ├─ miniprogram.config.js // mp-webpack-plugin 配置 50 | │ ├─ webpack.base.config.js // Web 端构建基础配置 51 | │ ├─ webpack.dev.config.js // Web 端构建开发环境配置 52 | │ ├─ webpack.mp.config.js // 小程序端构建配置 53 | │ └─ webpack.prod.config.js // Web 端构建生产环境配置 54 | ├─ dist 55 | │ ├─ mp // 小程序端目标代码目录,使用微信开发者工具打开,用于生产环境 56 | │ └─ web // web 端编译出的文件,用于生产环境 57 | ├─ src 58 | │ ├─ common // 通用组件 59 | │ ├─ mp // 小程序端入口目录 60 | │ │ ├─ home // 小程序端 home 页面 61 | │ │ │ └─ main.mp.js // 小程序端入口文件 62 | │ │ └─ other // 小程序端 other 页面 63 | │ │ └─ main.mp.js // 小程序端入口文件 64 | │ ├─ detail // detail 页面 65 | │ ├─ home // home 页面 66 | │ ├─ list // list 页面 67 | │ ├─ router // vue-router 路由定义 68 | │ ├─ store // vuex 相关目录 69 | │ ├─ App.vue // Web 端入口主视图 70 | │ └─ main.js // Web 端入口文件 71 | └─ index.html // Web 端入口模板 72 | ``` 73 | 74 | ## 其他说明 75 | 76 | 如果要使用 ts,则在 vue 的 script 标签上加上 `lang="ts"`,具体可参考 src/list/Index.vue。如果要使用 reduce-loader,就不能使用 ts,因为 ts 目前没有支持内联 loader。 77 | 78 | ## License 79 | 80 | MIT 81 | -------------------------------------------------------------------------------- /mpvue/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | var fileExtConfig = { 4 | swan: { 5 | template: 'swan', 6 | script: 'js', 7 | style: 'css', 8 | platform: 'swan' 9 | }, 10 | tt: { 11 | template: 'ttml', 12 | script: 'js', 13 | style: 'ttss', 14 | platform: 'tt' 15 | }, 16 | wx: { 17 | template: 'wxml', 18 | script: 'js', 19 | style: 'wxss', 20 | platform: 'wx' 21 | }, 22 | my: { 23 | template: 'axml', 24 | script: 'js', 25 | style: 'acss', 26 | platform: 'my' 27 | } 28 | } 29 | var fileExt = fileExtConfig[process.env.PLATFORM] 30 | 31 | module.exports = { 32 | build: { 33 | env: require('./prod.env'), 34 | index: path.resolve(__dirname, `../dist/${fileExt.platform}/index.html`), 35 | assetsRoot: path.resolve(__dirname, `../dist/${fileExt.platform}`), 36 | assetsSubDirectory: '', 37 | assetsPublicPath: '/', 38 | productionSourceMap: false, 39 | // Gzip off by default as many popular static hosts such as 40 | // Surge or Netlify already gzip all static assets for you. 41 | // Before setting to `true`, make sure to: 42 | // npm install --save-dev compression-webpack-plugin 43 | productionGzip: false, 44 | productionGzipExtensions: ['js', 'css'], 45 | // Run the build command with an extra argument to 46 | // View the bundle analyzer report after build finishes: 47 | // `npm run build --report` 48 | // Set to `true` or `false` to always turn it on or off 49 | bundleAnalyzerReport: process.env.npm_config_report, 50 | fileExt: fileExt 51 | }, 52 | dev: { 53 | env: require('./dev.env'), 54 | port: 8080, 55 | // 在小程序开发者工具中不需要自动打开浏览器 56 | autoOpenBrowser: false, 57 | assetsSubDirectory: '', 58 | assetsPublicPath: '/', 59 | proxyTable: {}, 60 | // CSS Sourcemaps off by default because relative paths are "buggy" 61 | // with this option, according to the CSS-Loader README 62 | // (https://github.com/webpack/css-loader#sourcemaps) 63 | // In our experience, they generally work as expected, 64 | // just be aware of this issue when enabling this option. 65 | cssSourceMap: false, 66 | fileExt: fileExt 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /taro/config/index.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | projectName: 'taro-test', 3 | date: '2020-3-26', 4 | designWidth: 750, 5 | deviceRatio: { 6 | '640': 2.34 / 2, 7 | '750': 1, 8 | '828': 1.81 / 2 9 | }, 10 | sourceRoot: 'src', 11 | outputRoot: 'dist', 12 | babel: { 13 | sourceMap: true, 14 | presets: [ 15 | ['env', { 16 | modules: false 17 | }] 18 | ], 19 | plugins: [ 20 | 'transform-decorators-legacy', 21 | 'transform-class-properties', 22 | 'transform-object-rest-spread', 23 | ['transform-runtime', { 24 | 'helpers': false, 25 | 'polyfill': false, 26 | 'regenerator': true, 27 | 'moduleName': 'babel-runtime' 28 | }] 29 | ] 30 | }, 31 | plugins: [], 32 | defineConstants: { 33 | }, 34 | mini: { 35 | postcss: { 36 | pxtransform: { 37 | enable: true, 38 | config: {} 39 | }, 40 | url: { 41 | enable: true, 42 | config: { 43 | limit: 10240 // 设定转换尺寸上限 44 | } 45 | }, 46 | cssModules: { 47 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true 48 | config: { 49 | namingPattern: 'module', // 转换模式,取值为 global/module 50 | generateScopedName: '[name]__[local]___[hash:base64:5]' 51 | } 52 | } 53 | } 54 | }, 55 | h5: { 56 | publicPath: process.env.NODE_ENV==='development'?'/':'./', 57 | staticDirectory: 'static', 58 | postcss: { 59 | autoprefixer: { 60 | enable: true, 61 | config: { 62 | browsers: [ 63 | 'last 3 versions', 64 | 'Android >= 4.1', 65 | 'ios >= 8' 66 | ] 67 | } 68 | }, 69 | cssModules: { 70 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true 71 | config: { 72 | namingPattern: 'module', // 转换模式,取值为 global/module 73 | generateScopedName: '[name]__[local]___[hash:base64:5]' 74 | } 75 | } 76 | }, 77 | router: { 78 | mode: 'hash', // 或者是 'browser' 79 | basename: '/testProject/taro/' 80 | } 81 | } 82 | } 83 | 84 | module.exports = function (merge) { 85 | if (process.env.NODE_ENV === 'development') { 86 | return merge({}, config, require('./dev')) 87 | } 88 | return merge({}, config, require('./prod')) 89 | } 90 | -------------------------------------------------------------------------------- /uniapp-vue3/src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 66 | 67 | 77 | -------------------------------------------------------------------------------- /taro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "taro-test", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "taro 性能测试", 6 | "templateInfo": { 7 | "name": "default", 8 | "typescript": false, 9 | "css": "none" 10 | }, 11 | "scripts": { 12 | "build:weapp": "taro build --type weapp", 13 | "build:swan": "taro build --type swan", 14 | "build:alipay": "taro build --type alipay", 15 | "build:tt": "taro build --type tt", 16 | "build:h5": "taro build --type h5", 17 | "build:rn": "taro build --type rn", 18 | "build:qq": "taro build --type qq", 19 | "build:quickapp": "taro build --type quickapp", 20 | "dev:weapp": "npm run build:weapp -- --watch", 21 | "dev:swan": "npm run build:swan -- --watch", 22 | "dev:alipay": "npm run build:alipay -- --watch", 23 | "dev:tt": "npm run build:tt -- --watch", 24 | "dev:h5": "npm run build:h5 -- --watch", 25 | "dev:rn": "npm run build:rn -- --watch", 26 | "dev:qq": "npm run build:qq -- --watch", 27 | "dev:quickapp": "npm run build:quickapp -- --watch" 28 | }, 29 | "author": "", 30 | "license": "MIT", 31 | "dependencies": { 32 | "@tarojs/components": "2.0.7", 33 | "@tarojs/components-qa": "2.0.7", 34 | "@tarojs/router": "2.0.7", 35 | "@tarojs/taro": "2.0.7", 36 | "@tarojs/taro-alipay": "2.0.7", 37 | "@tarojs/taro-h5": "2.0.7", 38 | "@tarojs/taro-qq": "2.0.7", 39 | "@tarojs/taro-quickapp": "2.0.7", 40 | "@tarojs/taro-swan": "2.0.7", 41 | "@tarojs/taro-tt": "2.0.7", 42 | "@tarojs/taro-weapp": "2.0.7", 43 | "@tarojs/taro-rn": "2.0.7", 44 | "babel-runtime": "^6.26.0", 45 | "regenerator-runtime": "0.11.1", 46 | "nervjs": "^1.5.5", 47 | "nerv-devtools": "^1.5.5" 48 | }, 49 | "devDependencies": { 50 | "@types/react": "^16.4.6", 51 | "@types/webpack-env": "^1.13.6", 52 | "@tarojs/mini-runner": "2.0.7", 53 | "@tarojs/webpack-runner": "2.0.7", 54 | "babel-plugin-transform-class-properties": "^6.24.1", 55 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 56 | "babel-plugin-transform-jsx-stylesheet": "^0.6.5", 57 | "babel-plugin-transform-object-rest-spread": "^6.26.0", 58 | "babel-plugin-transform-runtime": "^6.23.0", 59 | "babel-preset-env": "^1.6.1", 60 | "babel-eslint": "^8.2.3", 61 | "eslint": "^5.16.0", 62 | "eslint-config-taro": "2.0.7", 63 | "eslint-plugin-react": "^7.8.2", 64 | "eslint-plugin-react-hooks": "^1.6.1", 65 | "eslint-plugin-import": "^2.12.0", 66 | "stylelint": "9.3.0", 67 | "stylelint-config-taro-rn": "2.0.7", 68 | "stylelint-taro-rn": "2.0.7", 69 | "eslint-plugin-taro": "2.0.7" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /kbone/build/webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack') 2 | const merge = require('webpack-merge') 3 | const baseWebpackConfig = require('./webpack.base.config') 4 | const HtmlWebpackPlugin = require('html-webpack-plugin') 5 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 6 | const portfinder = require('portfinder') 7 | const autoprefixer = require('autoprefixer') 8 | const {VueLoaderPlugin} = require('vue-loader') 9 | 10 | const devWebpackConfig = merge(baseWebpackConfig, { 11 | mode: 'development', 12 | devServer: { 13 | clientLogLevel: 'warning', 14 | historyApiFallback: { 15 | rewrites: [{from: /.*/, to: '/index.html'}], 16 | }, 17 | hot: true, 18 | contentBase: false, 19 | compress: true, 20 | host: process.env.HOST || 'localhost', 21 | port: +process.env.PORT || 8080, 22 | open: true, // 自动打开浏览器 23 | overlay: {warnings: false, errors: true}, // 展示全屏报错 24 | publicPath: '/', 25 | proxy: {}, 26 | quiet: true, // for FriendlyErrorsPlugin 27 | watchOptions: { 28 | poll: false, 29 | } 30 | }, 31 | module: { 32 | rules: [{ 33 | test: /\.(less|css)$/, 34 | use: [{ 35 | loader: 'vue-style-loader', 36 | }, { 37 | loader: 'css-loader', 38 | }, { 39 | loader: 'postcss-loader', 40 | options: { 41 | plugins: [ 42 | autoprefixer, 43 | ], 44 | } 45 | }, { 46 | loader: 'less-loader', 47 | }], 48 | }], 49 | }, 50 | devtool: 'cheap-module-eval-source-map', 51 | plugins: [ 52 | new webpack.DefinePlugin({ 53 | 'process.env': { 54 | NODE_ENV: '"development"', 55 | }, 56 | }), 57 | new VueLoaderPlugin(), 58 | new webpack.HotModuleReplacementPlugin(), 59 | new webpack.NamedModulesPlugin(), // 开启 HMR 的时候使用该插件会显示模块的相对路径 60 | new webpack.NoEmitOnErrorsPlugin(), 61 | new HtmlWebpackPlugin({ 62 | filename: 'index.html', 63 | template: 'index.html', 64 | inject: true, 65 | }), 66 | ], 67 | }) 68 | 69 | module.exports = new Promise((resolve, reject) => { 70 | portfinder.basePort = +process.env.PORT || 8080 71 | portfinder.getPort((err, port) => { 72 | if (err) { 73 | reject(err) 74 | } else { 75 | devWebpackConfig.devServer.port = port 76 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 77 | compilationSuccessInfo: { 78 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 79 | }, 80 | onErrors: undefined, 81 | })) 82 | 83 | resolve(devWebpackConfig) 84 | } 85 | }) 86 | }) 87 | -------------------------------------------------------------------------------- /uniapp-vue3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uni-preset-vue", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev:app": "uni -p app", 6 | "dev:custom": "uni -p", 7 | "dev:h5": "uni", 8 | "dev:h5:ssr": "uni --ssr", 9 | "dev:mp-alipay": "uni -p mp-alipay", 10 | "dev:mp-baidu": "uni -p mp-baidu", 11 | "dev:mp-kuaishou": "uni -p mp-kuaishou", 12 | "dev:mp-lark": "uni -p mp-lark", 13 | "dev:mp-qq": "uni -p mp-qq", 14 | "dev:mp-toutiao": "uni -p mp-toutiao", 15 | "dev:mp-weixin": "uni -p mp-weixin", 16 | "dev:quickapp-webview": "uni -p quickapp-webview", 17 | "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei", 18 | "dev:quickapp-webview-union": "uni -p quickapp-webview-union", 19 | "build:app": "uni build -p app", 20 | "build:custom": "uni build -p", 21 | "build:h5": "uni build", 22 | "build:h5:ssr": "uni build --ssr", 23 | "build:mp-alipay": "uni build -p mp-alipay", 24 | "build:mp-baidu": "uni build -p mp-baidu", 25 | "build:mp-kuaishou": "uni build -p mp-kuaishou", 26 | "build:mp-lark": "uni build -p mp-lark", 27 | "build:mp-qq": "uni build -p mp-qq", 28 | "build:mp-toutiao": "uni build -p mp-toutiao", 29 | "build:mp-weixin": "uni build -p mp-weixin", 30 | "build:quickapp-webview": "uni build -p quickapp-webview", 31 | "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", 32 | "build:quickapp-webview-union": "uni build -p quickapp-webview-union" 33 | }, 34 | "dependencies": { 35 | "@dcloudio/uni-app": "^3.0.0-alpha-3030420211228003", 36 | "@dcloudio/uni-app-plus": "^3.0.0-alpha-3030420211228003", 37 | "@dcloudio/uni-components": "^3.0.0-alpha-3030420211228003", 38 | "@dcloudio/uni-h5": "^3.0.0-alpha-3030420211228003", 39 | "@dcloudio/uni-mp-alipay": "^3.0.0-alpha-3030420211228003", 40 | "@dcloudio/uni-mp-baidu": "^3.0.0-alpha-3030420211228003", 41 | "@dcloudio/uni-mp-kuaishou": "^3.0.0-alpha-3030420211228003", 42 | "@dcloudio/uni-mp-lark": "^3.0.0-alpha-3030420211228003", 43 | "@dcloudio/uni-mp-qq": "^3.0.0-alpha-3030420211228003", 44 | "@dcloudio/uni-mp-toutiao": "^3.0.0-alpha-3030420211228003", 45 | "@dcloudio/uni-mp-weixin": "^3.0.0-alpha-3030420211228003", 46 | "@dcloudio/uni-quickapp-webview": "^3.0.0-alpha-3030420211228003", 47 | "vue": "^3.2.26", 48 | "vue-i18n": "^9.1.9", 49 | "vuex": "^4.0.2" 50 | }, 51 | "devDependencies": { 52 | "@dcloudio/types": "^2.5.15", 53 | "@dcloudio/uni-automator": "^3.0.0-alpha-3030420211228003", 54 | "@dcloudio/uni-cli-shared": "^3.0.0-alpha-3030420211228003", 55 | "@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3030420211228003", 56 | "autoprefixer": "^10.4.0", 57 | "vite": "^2.7.9" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /mpvue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mpvue", 3 | "version": "1.0.0", 4 | "mpvueTemplateProjectVersion": "0.1.0", 5 | "description": "A Mpvue project", 6 | "author": "mehaotian <490272692@qq.com>", 7 | "private": true, 8 | "scripts": { 9 | "dev:wx": "node build/dev-server.js wx", 10 | "start:wx": "npm run dev:wx", 11 | "build:wx": "node build/build.js wx", 12 | "dev:swan": "node build/dev-server.js swan", 13 | "start:swan": "npm run dev:swan", 14 | "build:swan": "node build/build.js swan", 15 | "dev:tt": "node build/dev-server.js tt", 16 | "start:tt": "npm run dev:tt", 17 | "build:tt": "node build/build.js tt", 18 | "dev:my": "node build/dev-server.js my", 19 | "start:my": "npm run dev:my", 20 | "build:my": "node build/build.js my", 21 | "dev": "node build/dev-server.js wx", 22 | "start": "npm run dev", 23 | "build": "node build/build.js wx" 24 | }, 25 | "dependencies": { 26 | "mpvue": "^2.0.0", 27 | "vuex": "^3.0.1" 28 | }, 29 | "devDependencies": { 30 | "babel-core": "^6.22.1", 31 | "babel-loader": "^7.1.1", 32 | "babel-plugin-transform-runtime": "^6.22.0", 33 | "babel-preset-env": "^1.3.2", 34 | "babel-preset-stage-2": "^6.22.0", 35 | "babel-register": "^6.22.0", 36 | "chalk": "^2.4.0", 37 | "connect-history-api-fallback": "^1.3.0", 38 | "copy-webpack-plugin": "^4.5.1", 39 | "css-loader": "^0.28.11", 40 | "cssnano": "^3.10.0", 41 | "eventsource-polyfill": "^0.9.6", 42 | "express": "^4.16.3", 43 | "extract-text-webpack-plugin": "^3.0.2", 44 | "file-loader": "^1.1.11", 45 | "friendly-errors-webpack-plugin": "^1.7.0", 46 | "glob": "^7.1.2", 47 | "html-webpack-plugin": "^3.2.0", 48 | "http-proxy-middleware": "^0.18.0", 49 | "optimize-css-assets-webpack-plugin": "^3.2.0", 50 | "ora": "^2.0.0", 51 | "portfinder": "^1.0.13", 52 | "postcss-loader": "^2.1.4", 53 | "postcss-mpvue-wxss": "^1.0.0", 54 | "prettier": "~1.12.1", 55 | "px2rpx-loader": "^0.1.10", 56 | "relative": "^3.0.2", 57 | "rimraf": "^2.6.0", 58 | "semver": "^5.3.0", 59 | "shelljs": "^0.8.1", 60 | "uglifyjs-webpack-plugin": "^1.2.5", 61 | "url-loader": "^1.0.1", 62 | "vue-style-loader": "^4.1.0", 63 | "mkdirp": "^0.5.1", 64 | "mpvue-loader": "^2.0.0", 65 | "mpvue-template-compiler": "^2.0.0", 66 | "mpvue-webpack-target": "^1.0.3", 67 | "webpack-mpvue-vendor-plugin": "^2.0.0", 68 | "webpack-mpvue-asset-plugin": "^2.0.0", 69 | "webpack-bundle-analyzer": "^3.6.1", 70 | "webpack-dev-middleware-hard-disk": "^1.12.0", 71 | "webpack-merge": "^4.1.0", 72 | "webpack": "^3.11.0" 73 | }, 74 | "engines": { 75 | "node": ">= 4.0.0", 76 | "npm": ">= 3.0.0" 77 | }, 78 | "browserslist": [ 79 | "> 1%", 80 | "last 2 versions", 81 | "not ie <= 8" 82 | ] 83 | } 84 | -------------------------------------------------------------------------------- /taro/src/components/card/card.css: -------------------------------------------------------------------------------- 1 | .uni-media-list { 2 | background: #fff; 3 | margin-bottom: 20px; 4 | } 5 | 6 | .uni-media_header-box { 7 | display: flex; 8 | flex-direction: row; 9 | padding: 15px 20px; 10 | } 11 | 12 | .uni-media_header { 13 | width: 90px; 14 | height: 90px; 15 | border-radius: 200px; 16 | border: 1px #f5f5f5 solid; 17 | overflow: hidden; 18 | } 19 | 20 | .uni-media_image { 21 | width: 90px; 22 | height: 90px; 23 | } 24 | 25 | .uni-media_header-info { 26 | flex-direction: column; 27 | justify-content: space-between; 28 | padding: 4px 0; 29 | padding-left: 20px; 30 | font-size: 26px; 31 | color: #999; 32 | } 33 | 34 | .uni-media_info-name { 35 | font-size: 36px; 36 | color: #ff5a5f; 37 | } 38 | 39 | .uni-media_info-from { 40 | display: flex; 41 | flex-direction: row; 42 | } 43 | 44 | .from-text { 45 | font-size: 26px; 46 | } 47 | 48 | .uni-media_content-box { 49 | /* padding: 20px 0; */ 50 | } 51 | 52 | .uni-media_content-text { 53 | font-size: 28px; 54 | color: #333; 55 | padding: 0 20px; 56 | } 57 | 58 | .uni-media_content-iamges { 59 | display: flex; 60 | flex-direction: row; 61 | flex-wrap: wrap; 62 | padding: 10px; 63 | } 64 | 65 | .uni-media_content-img { 66 | position: relative; 67 | width: 240px; 68 | height: 0; 69 | padding-top: 240px; 70 | } 71 | 72 | .uni-media_content-img-item { 73 | position: absolute; 74 | top: 0; 75 | left: 0; 76 | width: 230px; 77 | height: 230px; 78 | padding: 10px; 79 | overflow: hidden; 80 | } 81 | 82 | .uni-media_content-img-item-img { 83 | width: 230px; 84 | height: 230px; 85 | } 86 | 87 | .uni-media_groups { 88 | display: flex; 89 | flex-direction: row; 90 | height: 80px; 91 | border-top-color: #f5f5f5; 92 | border-top-width: 1px; 93 | margin: 0 20px; 94 | } 95 | 96 | .uni-media_groups-item { 97 | display: flex; 98 | flex-direction: row; 99 | align-items: center; 100 | justify-content: center; 101 | font-size: 24px; 102 | color: #666; 103 | flex: 1; 104 | } 105 | 106 | .uni-media_groups-item-iconfont { 107 | align-items: center; 108 | justify-content: center; 109 | color: #666; 110 | font-size: 28px; 111 | margin-right: 10px; 112 | } 113 | 114 | .uni-media_groups-item-active { 115 | color: #ff5a5f; 116 | } 117 | 118 | 119 | 120 | @font-face {font-family: "iconfont"; 121 | src: url('https://at.alicdn.com/t/font_1105050_zol10etauus.ttf?t=1553398395662') format('truetype'); /* IE9 */ 122 | } 123 | 124 | .iconfont { 125 | font-family: "iconfont"; 126 | font-size: 32px; 127 | font-style: normal; 128 | } 129 | 130 | .icon-pinglun:before { 131 | content: "\e61b"; 132 | } 133 | 134 | .icon-dianzan1:before { 135 | content: "\e600"; 136 | } 137 | 138 | .icon-fenxiang-copy:before { 139 | content: "\e603"; 140 | } 141 | -------------------------------------------------------------------------------- /taro-next/src/components/card/card.css: -------------------------------------------------------------------------------- 1 | .uni-media-list { 2 | background: #fff; 3 | margin-bottom: 20px; 4 | } 5 | 6 | .uni-media_header-box { 7 | display: flex; 8 | flex-direction: row; 9 | padding: 15px 20px; 10 | } 11 | 12 | .uni-media_header { 13 | width: 90px; 14 | height: 90px; 15 | border-radius: 200px; 16 | border: 1px #f5f5f5 solid; 17 | overflow: hidden; 18 | } 19 | 20 | .uni-media_image { 21 | width: 90px; 22 | height: 90px; 23 | } 24 | 25 | .uni-media_header-info { 26 | flex-direction: column; 27 | justify-content: space-between; 28 | padding: 4px 0; 29 | padding-left: 20px; 30 | font-size: 26px; 31 | color: #999; 32 | } 33 | 34 | .uni-media_info-name { 35 | font-size: 36px; 36 | color: #ff5a5f; 37 | } 38 | 39 | .uni-media_info-from { 40 | display: flex; 41 | flex-direction: row; 42 | } 43 | 44 | .from-text { 45 | font-size: 26px; 46 | } 47 | 48 | .uni-media_content-box { 49 | /* padding: 20px 0; */ 50 | } 51 | 52 | .uni-media_content-text { 53 | font-size: 28px; 54 | color: #333; 55 | padding: 0 20px; 56 | } 57 | 58 | .uni-media_content-iamges { 59 | display: flex; 60 | flex-direction: row; 61 | flex-wrap: wrap; 62 | padding: 10px; 63 | } 64 | 65 | .uni-media_content-img { 66 | position: relative; 67 | width: 240px; 68 | height: 0; 69 | padding-top: 240px; 70 | } 71 | 72 | .uni-media_content-img-item { 73 | position: absolute; 74 | top: 0; 75 | left: 0; 76 | width: 230px; 77 | height: 230px; 78 | padding: 10px; 79 | overflow: hidden; 80 | } 81 | 82 | .uni-media_content-img-item-img { 83 | width: 230px; 84 | height: 230px; 85 | } 86 | 87 | .uni-media_groups { 88 | display: flex; 89 | flex-direction: row; 90 | height: 80px; 91 | border-top-color: #f5f5f5; 92 | border-top-width: 1px; 93 | margin: 0 20px; 94 | } 95 | 96 | .uni-media_groups-item { 97 | display: flex; 98 | flex-direction: row; 99 | align-items: center; 100 | justify-content: center; 101 | font-size: 24px; 102 | color: #666; 103 | flex: 1; 104 | } 105 | 106 | .uni-media_groups-item-iconfont { 107 | align-items: center; 108 | justify-content: center; 109 | color: #666; 110 | font-size: 28px; 111 | margin-right: 10px; 112 | } 113 | 114 | .uni-media_groups-item-active { 115 | color: #ff5a5f; 116 | } 117 | 118 | 119 | 120 | @font-face {font-family: "iconfont"; 121 | src: url('https://at.alicdn.com/t/font_1105050_zol10etauus.ttf?t=1553398395662') format('truetype'); /* IE9 */ 122 | } 123 | 124 | .iconfont { 125 | font-family: "iconfont"; 126 | font-size: 32px; 127 | font-style: normal; 128 | } 129 | 130 | .icon-pinglun:before { 131 | content: "\e61b"; 132 | } 133 | 134 | .icon-dianzan1:before { 135 | content: "\e600"; 136 | } 137 | 138 | .icon-fenxiang-copy:before { 139 | content: "\e603"; 140 | } 141 | -------------------------------------------------------------------------------- /uniapp-vue3/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "debug":false, 3 | "name" : "hello", 4 | "appid" : "__UNI__4DCD124", 5 | "description" : "", 6 | "versionName" : "1.0.0", 7 | "versionCode" : "100", 8 | "transformPx" : false, 9 | /* 5+App特有相关 */ 10 | "app-plus" : { 11 | "usingComponents" : true, 12 | "nvueStyleCompiler" : "uni-app", 13 | "compilerVersion" : 3, 14 | "splashscreen" : { 15 | "alwaysShowBeforeRender" : true, 16 | "waiting" : true, 17 | "autoclose" : true, 18 | "delay" : 0 19 | }, 20 | /* 模块配置 */ 21 | "modules" : {}, 22 | /* 应用发布信息 */ 23 | "distribute" : { 24 | /* android打包配置 */ 25 | "android" : { 26 | "permissions" : [ 27 | "", 28 | "", 29 | "", 30 | "", 31 | "", 32 | "", 33 | "", 34 | "", 35 | "", 36 | "", 37 | "", 38 | "", 39 | "", 40 | "", 41 | "" 42 | ] 43 | }, 44 | /* ios打包配置 */ 45 | "ios" : {}, 46 | /* SDK配置 */ 47 | "sdkConfigs" : {} 48 | } 49 | }, 50 | /* 快应用特有相关 */ 51 | "quickapp" : {}, 52 | /* 小程序特有相关 */ 53 | "mp-weixin" : { 54 | "appid" : "wx9dcdaed5b2bc94ad", 55 | "setting" : { 56 | "urlCheck" : false 57 | }, 58 | "usingComponents" : true 59 | }, 60 | "mp-alipay" : { 61 | "usingComponents" : true 62 | }, 63 | "mp-baidu" : { 64 | "usingComponents" : true 65 | }, 66 | "mp-toutiao" : { 67 | "usingComponents" : true 68 | }, 69 | "uniStatistics": { 70 | "enable": false 71 | }, 72 | "vueVersion" : "3" 73 | } 74 | -------------------------------------------------------------------------------- /uni-app-v3/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | // export default performance 105 | 106 | module.exports = performance 107 | -------------------------------------------------------------------------------- /kbone/build/webpack.base.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const eslintFriendlyFormatter = require('eslint-friendly-formatter') 3 | 4 | module.exports = { 5 | context: path.resolve(__dirname, '../'), 6 | entry: { 7 | app: path.resolve(__dirname, '../src/main.js'), 8 | }, 9 | output: { 10 | path: path.resolve(__dirname, '../dist/web'), 11 | filename: '[name].js', 12 | publicPath: '/', 13 | }, 14 | module: { 15 | rules: [ 16 | // eslint 17 | { 18 | test: /\.(js|vue)$/, 19 | loader: 'eslint-loader', 20 | enforce: 'pre', 21 | include: [path.resolve(__dirname, '../src')], 22 | options: { 23 | formatter: eslintFriendlyFormatter, 24 | emitWarning: true, 25 | }, 26 | }, 27 | // vue 28 | { 29 | test: /\.vue$/, 30 | use: [{ 31 | loader: 'thread-loader', 32 | }, { 33 | loader: 'vue-loader', 34 | options: { 35 | compilerOptions: { 36 | preserveWhitespace: false, 37 | }, 38 | }, 39 | }], 40 | }, 41 | // ts 42 | { 43 | test: /\.tsx?$/, 44 | exclude: /node_modules/, 45 | use: [{ 46 | loader: 'thread-loader', 47 | }, { 48 | loader: 'babel-loader', 49 | options: { 50 | cacheDirectory: true, 51 | }, 52 | }, { 53 | loader: 'ts-loader', 54 | options: { 55 | appendTsSuffixTo: [/\.vue$/], 56 | happyPackMode: true, 57 | }, 58 | }], 59 | }, 60 | // js 61 | { 62 | test: /\.js$/, 63 | loader: 'babel-loader', 64 | include: [path.resolve(__dirname, '../src')], 65 | }, 66 | // img res 67 | { 68 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 69 | loader: 'url-loader', 70 | options: { 71 | limit: 10000, 72 | name: path.posix.join('static', 'img/[name].[hash:7].[ext]'), 73 | }, 74 | }, 75 | // media res 76 | { 77 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 78 | loader: 'url-loader', 79 | options: { 80 | limit: 10000, 81 | name: path.posix.join('static', 'media/[name].[hash:7].[ext]'), 82 | }, 83 | }, 84 | // font res 85 | { 86 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 87 | loader: 'url-loader', 88 | options: { 89 | limit: 10000, 90 | name: path.posix.join('static', 'fonts/[name].[hash:7].[ext]'), 91 | }, 92 | } 93 | ], 94 | }, 95 | resolve: { 96 | extensions: ['.js', '.vue', '.json'], 97 | alias: { 98 | 'vue$': 'vue/dist/vue.esm.js', 99 | '@': path.resolve(__dirname, '../src'), 100 | }, 101 | }, 102 | node: { 103 | // 避免 webpack 注入不必要的 setImmediate polyfill 因为 Vue 已经将其包含在内 104 | setImmediate: false, 105 | }, 106 | } 107 | -------------------------------------------------------------------------------- /wepy/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | export default performance 105 | -------------------------------------------------------------------------------- /chameleon/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | export default performance 105 | -------------------------------------------------------------------------------- /mpvue/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | export default performance 105 | -------------------------------------------------------------------------------- /taro/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | // export default performance 105 | module.exports = performance 106 | -------------------------------------------------------------------------------- /taro-next/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | // export default performance 105 | module.exports = performance 106 | -------------------------------------------------------------------------------- /wechat/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | filterEntries = filterEntries || _entries 14 | let i = 0 15 | const n = filterEntries.length 16 | const result = [] 17 | for (; i < n; i++) { 18 | if (filterEntries[i][key] === value) { 19 | result.push(filterEntries[i]) 20 | } 21 | } 22 | return result 23 | } 24 | 25 | function _clearEntries (type, name) { 26 | let i = _entries.length 27 | let entry 28 | while (i--) { 29 | entry = _entries[i] 30 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 31 | _entries.splice(i, 1) 32 | } 33 | } 34 | } 35 | 36 | performance.now = function () { 37 | return (Date.now ? Date.now() : +(new Date())) - startOffset 38 | } 39 | 40 | performance.mark = function (name) { 41 | const mark = { 42 | name: name, 43 | entryType: 'mark', 44 | startTime: performance.now(), 45 | duration: 0 46 | } 47 | _entries.push(mark) 48 | _marksIndex[name] = mark 49 | } 50 | 51 | performance.measure = function (name, startMark, endMark) { 52 | let startTime 53 | let endTime 54 | console.log(endMark, _marksIndex[endMark]) 55 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 56 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 57 | "' does not exist.") 58 | } 59 | 60 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 61 | throw new SyntaxError("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 62 | "' does not exist.") 63 | } 64 | 65 | if (_marksIndex[startMark]) { 66 | startTime = _marksIndex[startMark].startTime 67 | } else { 68 | startTime = 0 69 | } 70 | 71 | if (_marksIndex[endMark]) { 72 | endTime = _marksIndex[endMark].startTime 73 | } else { 74 | endTime = performance.now() 75 | } 76 | 77 | _entries.push({ 78 | name: name, 79 | entryType: 'measure', 80 | startTime: startTime, 81 | duration: endTime - startTime 82 | }) 83 | } 84 | 85 | performance.getEntriesByType = function (type) { 86 | return _filterEntries('entryType', type) 87 | } 88 | 89 | performance.getEntriesByName = function (name, type) { 90 | if (type) { 91 | return _filterEntries('entryType', type, _filterEntries('name', name)) 92 | } 93 | return _filterEntries('name', name) 94 | } 95 | 96 | performance.clearMarks = function (name) { 97 | _clearEntries('mark', name) 98 | } 99 | 100 | performance.clearMeasures = function (name) { 101 | _clearEntries('measure', name) 102 | } 103 | 104 | export default performance 105 | -------------------------------------------------------------------------------- /uniapp-vue3/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | if(!filterEntries || filterEntries.length === 0){ 14 | filterEntries = _entries 15 | } 16 | 17 | // filterEntries = filterEntries || _entries 18 | let i = 0 19 | const n = filterEntries.length 20 | 21 | const result = [] 22 | for (; i < n; i++) { 23 | if (filterEntries[i][key] === value) { 24 | result.push(filterEntries[i]) 25 | } 26 | } 27 | 28 | return result 29 | } 30 | 31 | function _clearEntries (type, name) { 32 | let i = _entries.length 33 | let entry 34 | while (i--) { 35 | entry = _entries[i] 36 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 37 | _entries.splice(i, 1) 38 | } 39 | } 40 | } 41 | 42 | performance.now = function () { 43 | return (Date.now ? Date.now() : +(new Date())) - startOffset 44 | } 45 | 46 | performance.mark = function (name) { 47 | const mark = { 48 | name: name, 49 | entryType: 'mark', 50 | startTime: performance.now(), 51 | duration: 0 52 | } 53 | _entries.push(mark) 54 | _marksIndex[name] = mark 55 | } 56 | 57 | performance.measure = function (name, startMark, endMark) { 58 | let startTime 59 | let endTime 60 | 61 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 62 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 63 | "' does not exist.") 64 | } 65 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 66 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 67 | "' does not exist.") 68 | } 69 | 70 | if (_marksIndex[startMark]) { 71 | startTime = _marksIndex[startMark].startTime 72 | } else { 73 | startTime = 0 74 | } 75 | 76 | if (_marksIndex[endMark]) { 77 | endTime = _marksIndex[endMark].startTime 78 | } else { 79 | endTime = performance.now() 80 | } 81 | 82 | _entries.push({ 83 | name: name, 84 | entryType: 'measure', 85 | startTime: startTime, 86 | duration: endTime - startTime 87 | }) 88 | } 89 | 90 | performance.getEntriesByType = function (type) { 91 | return _filterEntries('entryType', type) 92 | } 93 | 94 | performance.getEntriesByName = function (name, type) { 95 | if (type) { 96 | 97 | return _filterEntries('entryType', type, _filterEntries('name', name)) 98 | } 99 | return _filterEntries('name', name) 100 | } 101 | 102 | performance.clearMarks = function (name) { 103 | _clearEntries('mark', name) 104 | } 105 | 106 | performance.clearMeasures = function (name) { 107 | _clearEntries('measure', name) 108 | } 109 | 110 | export default performance 111 | 112 | // module.exports = performance 113 | -------------------------------------------------------------------------------- /uni-app-v3/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uni-app-vue3", 3 | "appid": "", 4 | "description": "", 5 | "versionName": "1.0.0", 6 | "versionCode": "100", 7 | "transformPx": false, 8 | "uniStatistics": { 9 | "enable": false//全局关闭 10 | }, 11 | "app-plus": { /* 5+App特有相关 */ 12 | "usingComponents": true, 13 | "splashscreen": { 14 | "alwaysShowBeforeRender": true, 15 | "waiting": true, 16 | "autoclose": true, 17 | "delay": 0 18 | }, 19 | "modules": { /* 模块配置 */ 20 | 21 | }, 22 | "distribute": { /* 应用发布信息 */ 23 | "android": { /* android打包配置 */ 24 | "permissions": ["", 25 | "", 26 | "", 27 | "", 28 | "", 29 | "", 30 | "", 31 | "", 32 | "", 33 | "", 34 | "", 35 | "", 36 | "", 37 | "", 38 | "", 39 | "", 40 | "", 41 | "", 42 | "", 43 | "", 44 | "", 45 | "" 46 | ] 47 | }, 48 | "ios": { /* ios打包配置 */ 49 | 50 | }, 51 | "sdkConfigs": { /* SDK配置 */ 52 | 53 | } 54 | } 55 | }, 56 | "quickapp": { /* 快应用特有相关 */ 57 | 58 | }, 59 | "h5": { 60 | "optimization": { 61 | "treeShaking": { 62 | "enable": true 63 | } 64 | }, 65 | "router":{ 66 | "mode":"hash", 67 | "base":"/testProject/uniapp" 68 | } 69 | }, 70 | "mp-weixin": { /* 微信小程序特有相关 */ 71 | "appid": "wx9dcdaed5b2bc94ad", 72 | "setting": { 73 | "urlCheck": false 74 | }, 75 | "usingComponents": true 76 | }, 77 | "mp-alipay" : { 78 | "usingComponents" : true 79 | }, 80 | "mp-baidu" : { 81 | "usingComponents" : true 82 | }, 83 | "mp-toutiao" : { 84 | "usingComponents" : true 85 | }, 86 | "mp-qq" : { 87 | "usingComponents" : true 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /kbone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-kbone", 3 | "version": "0.0.1", 4 | "description": "", 5 | "author": "wechat-miniprogram", 6 | "keywords": [ 7 | "vue", 8 | "kbone", 9 | "mp" 10 | ], 11 | "scripts": { 12 | "start": "npm run mp", 13 | "web": "cross-env NODE_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.config.js", 14 | "mp": "cross-env NODE_ENV=development webpack --config build/webpack.mp.config.js --progress --hide-modules", 15 | "lint": "eslint --ext .js,.vue src --fix", 16 | "build": "rimraf dist/web && cross-env NODE_ENV=production webpack --config build/webpack.prod.config.js --progress --hide-modules", 17 | "build:mp": "cross-env NODE_ENV=production webpack --config build/webpack.mp.config.js --progress --hide-modules", 18 | "perf": "webpack --config build/webpack.perf.config.js --progress --hide-modules" 19 | }, 20 | "dependencies": { 21 | "vue": "^2.5.2", 22 | "vue-router": "^3.0.1", 23 | "vuex": "^3.1.2", 24 | "vuex-router-sync": "^5.0.0" 25 | }, 26 | "devDependencies": { 27 | "autoprefixer": "^7.1.2", 28 | "babel-core": "^6.22.1", 29 | "babel-eslint": "^8.2.1", 30 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 31 | "babel-loader": "^7.1.1", 32 | "babel-plugin-dynamic-import-node": "^1.2.0", 33 | "babel-plugin-syntax-jsx": "^6.18.0", 34 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 35 | "babel-plugin-transform-runtime": "^6.22.0", 36 | "babel-plugin-transform-vue-jsx": "^3.5.0", 37 | "babel-preset-env": "^1.3.2", 38 | "babel-preset-stage-2": "^6.22.0", 39 | "copy-webpack-plugin": "^5.1.1", 40 | "cross-env": "^6.0.3", 41 | "css-loader": "^3.4.0", 42 | "cssnano": "^4.1.10", 43 | "eslint": "^4.15.0", 44 | "eslint-config-airbnb-base": "^11.3.0", 45 | "eslint-friendly-formatter": "^3.0.0", 46 | "eslint-import-resolver-webpack": "^0.8.3", 47 | "eslint-loader": "^3.0.3", 48 | "eslint-plugin-import": "^2.19.1", 49 | "eslint-plugin-vue": "^4.0.0", 50 | "file-loader": "^1.1.4", 51 | "friendly-errors-webpack-plugin": "^1.6.1", 52 | "html-webpack-plugin": "^3.2.0", 53 | "less": "^3.10.3", 54 | "less-loader": "^5.0.0", 55 | "mini-css-extract-plugin": "^0.5.0", 56 | "mp-webpack-plugin": "latest", 57 | "node-notifier": "^5.1.2", 58 | "optimize-css-assets-webpack-plugin": "^5.0.3", 59 | "portfinder": "^1.0.25", 60 | "postcss-loader": "^2.0.8", 61 | "reduce-loader": "^0.1.1", 62 | "rimraf": "^2.7.1", 63 | "terser-webpack-plugin": "^2.3.0", 64 | "thread-loader": "^2.1.3", 65 | "ts-loader": "^6.2.1", 66 | "typescript": "^3.7.3", 67 | "url-loader": "^0.5.8", 68 | "vue-improve-loader": "^0.1.1", 69 | "vue-loader": "^15.7.2", 70 | "vue-style-loader": "^4.1.2", 71 | "vue-template-compiler": "^2.6.10", 72 | "webpack": "^4.41.2", 73 | "webpack-cli": "^3.3.10", 74 | "webpack-dev-server": "^3.9.0", 75 | "webpack-merge": "^4.1.0" 76 | }, 77 | "engines": { 78 | "node": ">= 6.0.0", 79 | "npm": ">= 3.0.0" 80 | }, 81 | "browserslist": [ 82 | "> 1%", 83 | "last 2 versions", 84 | "not ie <= 8" 85 | ] 86 | } 87 | -------------------------------------------------------------------------------- /uni-app/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 3 | * @author RubaXa 4 | */ 5 | 6 | const startOffset = Date.now ? Date.now() : +(new Date()) 7 | const performance = {} 8 | 9 | const _entries = [] 10 | const _marksIndex = {} 11 | 12 | function _filterEntries (key, value, filterEntries) { 13 | // filterEntries = filterEntries || _entries 14 | if(!filterEntries || filterEntries.length === 0){ 15 | filterEntries = _entries 16 | } 17 | let i = 0 18 | const n = filterEntries.length 19 | const result = [] 20 | for (; i < n; i++) { 21 | if (filterEntries[i][key] === value) { 22 | result.push(filterEntries[i]) 23 | } 24 | } 25 | return result 26 | } 27 | 28 | function _clearEntries (type, name) { 29 | let i = _entries.length 30 | let entry 31 | while (i--) { 32 | entry = _entries[i] 33 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 34 | _entries.splice(i, 1) 35 | } 36 | } 37 | } 38 | 39 | performance.now = function () { 40 | return (Date.now ? Date.now() : +(new Date())) - startOffset 41 | } 42 | 43 | performance.mark = function (name) { 44 | const mark = { 45 | name: name, 46 | entryType: 'mark', 47 | startTime: performance.now(), 48 | duration: 0 49 | } 50 | _entries.push(mark) 51 | _marksIndex[name] = mark 52 | } 53 | 54 | performance.measure = function (name, startMark, endMark) { 55 | let startTime 56 | let endTime 57 | 58 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 59 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + endMark + 60 | "' does not exist.") 61 | } 62 | 63 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 64 | return console.log("Failed to execute 'measure' on 'Performance': The mark '" + startMark + 65 | "' does not exist.") 66 | } 67 | 68 | if (_marksIndex[startMark]) { 69 | startTime = _marksIndex[startMark].startTime 70 | } else { 71 | startTime = 0 72 | } 73 | 74 | if (_marksIndex[endMark]) { 75 | endTime = _marksIndex[endMark].startTime 76 | } else { 77 | endTime = performance.now() 78 | } 79 | 80 | _entries.push({ 81 | name: name, 82 | entryType: 'measure', 83 | startTime: startTime, 84 | duration: endTime - startTime 85 | }) 86 | } 87 | 88 | performance.getEntriesByType = function (type) { 89 | return _filterEntries('entryType', type) 90 | } 91 | 92 | performance.getEntriesByName = function (name, type) { 93 | if (type) { 94 | return _filterEntries('entryType', type, _filterEntries('name', name)) 95 | } 96 | return _filterEntries('name', name) 97 | } 98 | 99 | performance.clearMarks = function (name) { 100 | _clearEntries('mark', name) 101 | } 102 | 103 | performance.clearMeasures = function (name) { 104 | _clearEntries('measure', name) 105 | } 106 | 107 | // export default performance 108 | 109 | module.exports = performance 110 | -------------------------------------------------------------------------------- /kbone/src/utils/performance.polyfill.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-void */ 2 | /* eslint-disable no-plusplus */ 3 | /* eslint-disable func-names */ 4 | /* eslint-disable no-param-reassign */ 5 | /* eslint-disable no-underscore-dangle */ 6 | /** 7 | * User Timing polyfill (http://www.w3.org/TR/user-timing/) 8 | * @author RubaXa 9 | */ 10 | 11 | const startOffset = Date.now ? Date.now() : +(new Date()) 12 | const performance = {} 13 | 14 | const _entries = [] 15 | const _marksIndex = {} 16 | 17 | function _filterEntries(key, value, filterEntries) { 18 | filterEntries = filterEntries || _entries 19 | let i = 0 20 | const n = filterEntries.length 21 | const result = [] 22 | for (; i < n; i += 1) { 23 | if (filterEntries[i][key] === value) { 24 | result.push(filterEntries[i]) 25 | } 26 | } 27 | return result 28 | } 29 | 30 | function _clearEntries(type, name) { 31 | let i = _entries.length 32 | let entry 33 | while (i--) { 34 | entry = _entries[i] 35 | if (entry.entryType === type && (name === void 0 || entry.name === name)) { 36 | _entries.splice(i, 1) 37 | } 38 | } 39 | } 40 | 41 | performance.now = function () { 42 | return (Date.now ? Date.now() : +(new Date())) - startOffset 43 | } 44 | 45 | performance.mark = function (name) { 46 | const mark = { 47 | name, 48 | entryType: 'mark', 49 | startTime: performance.now(), 50 | duration: 0 51 | } 52 | _entries.push(mark) 53 | _marksIndex[name] = mark 54 | } 55 | 56 | performance.measure = function (name, startMark, endMark) { 57 | let startTime 58 | let endTime 59 | 60 | if (endMark !== undefined && _marksIndex[endMark] === undefined) { 61 | throw new SyntaxError(`Failed to execute 'measure' on 'Performance': The mark '${endMark 62 | }' does not exist.`) 63 | } 64 | 65 | if (startMark !== undefined && _marksIndex[startMark] === undefined) { 66 | throw new SyntaxError(`Failed to execute 'measure' on 'Performance': The mark '${startMark 67 | }' does not exist.`) 68 | } 69 | 70 | if (_marksIndex[startMark]) { 71 | startTime = _marksIndex[startMark].startTime 72 | } else { 73 | startTime = 0 74 | } 75 | 76 | if (_marksIndex[endMark]) { 77 | endTime = _marksIndex[endMark].startTime 78 | } else { 79 | endTime = performance.now() 80 | } 81 | 82 | _entries.push({ 83 | name, 84 | entryType: 'measure', 85 | startTime, 86 | duration: endTime - startTime 87 | }) 88 | } 89 | 90 | performance.getEntriesByType = function (type) { 91 | return _filterEntries('entryType', type) 92 | } 93 | 94 | performance.getEntriesByName = function (name, type) { 95 | if (type) { 96 | return _filterEntries('entryType', type, _filterEntries('name', name)) 97 | } 98 | return _filterEntries('name', name) 99 | } 100 | 101 | performance.clearMarks = function (name) { 102 | _clearEntries('mark', name) 103 | } 104 | 105 | performance.clearMeasures = function (name) { 106 | _clearEntries('measure', name) 107 | } 108 | 109 | // export default performance 110 | 111 | module.exports = performance 112 | -------------------------------------------------------------------------------- /mpvue/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | // var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | var MpvueVendorPlugin = require('webpack-mpvue-vendor-plugin') 9 | 10 | // copy from ./webpack.prod.conf.js 11 | var path = require('path') 12 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 13 | var CopyWebpackPlugin = require('copy-webpack-plugin') 14 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 15 | 16 | // add hot-reload related code to entry chunks 17 | // Object.keys(baseWebpackConfig.entry).forEach(function (name) { 18 | // baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 19 | // }) 20 | 21 | module.exports = merge(baseWebpackConfig, { 22 | module: { 23 | rules: utils.styleLoaders({ 24 | sourceMap: config.dev.cssSourceMap, 25 | extract: true 26 | }) 27 | }, 28 | // cheap-module-eval-source-map is faster for development 29 | // devtool: '#cheap-module-eval-source-map', 30 | // devtool: '#source-map', 31 | output: { 32 | path: config.build.assetsRoot, 33 | // filename: utils.assetsPath('[name].[chunkhash].js'), 34 | // chunkFilename: utils.assetsPath('[id].[chunkhash].js') 35 | filename: utils.assetsPath('[name].js'), 36 | chunkFilename: utils.assetsPath('[id].js') 37 | }, 38 | plugins: [ 39 | new webpack.DefinePlugin({ 40 | 'process.env': config.dev.env 41 | }), 42 | 43 | // copy from ./webpack.prod.conf.js 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | // filename: utils.assetsPath('[name].[contenthash].css') 47 | filename: utils.assetsPath(`[name].${config.dev.fileExt.style}`) 48 | }), 49 | // Compress extracted CSS. We are using this plugin so that possible 50 | // duplicated CSS from different components can be deduped. 51 | new OptimizeCSSPlugin({ 52 | cssProcessorOptions: { 53 | safe: true 54 | } 55 | }), 56 | new webpack.optimize.CommonsChunkPlugin({ 57 | name: 'common/vendor', 58 | minChunks: function (module, count) { 59 | // any required modules inside node_modules are extracted to vendor 60 | return ( 61 | module.resource && 62 | /\.js$/.test(module.resource) && 63 | module.resource.indexOf('node_modules') >= 0 64 | ) || count > 1 65 | } 66 | }), 67 | new webpack.optimize.CommonsChunkPlugin({ 68 | name: 'common/manifest', 69 | chunks: ['common/vendor'] 70 | }), 71 | new MpvueVendorPlugin({ 72 | platform: process.env.PLATFORM 73 | }), 74 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 75 | // new webpack.HotModuleReplacementPlugin(), 76 | new webpack.NoEmitOnErrorsPlugin(), 77 | // https://github.com/ampedandwired/html-webpack-plugin 78 | // new HtmlWebpackPlugin({ 79 | // filename: 'index.html', 80 | // template: 'index.html', 81 | // inject: true 82 | // }), 83 | new FriendlyErrorsPlugin() 84 | ] 85 | }) 86 | -------------------------------------------------------------------------------- /uni-app/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "debug":false, 3 | "name": "uni-app", 4 | "appid": "", 5 | "description": "", 6 | "versionName": "1.0.0", 7 | "versionCode": "100", 8 | "transformPx": false, 9 | "uniStatistics": { 10 | "enable": false//全局关闭 11 | }, 12 | "app-plus": { /* 5+App特有相关 */ 13 | "usingComponents": true, 14 | "splashscreen": { 15 | "alwaysShowBeforeRender": true, 16 | "waiting": true, 17 | "autoclose": true, 18 | "delay": 0 19 | }, 20 | "modules": { /* 模块配置 */ 21 | 22 | }, 23 | "distribute": { /* 应用发布信息 */ 24 | "android": { /* android打包配置 */ 25 | "permissions": ["", 26 | "", 27 | "", 28 | "", 29 | "", 30 | "", 31 | "", 32 | "", 33 | "", 34 | "", 35 | "", 36 | "", 37 | "", 38 | "", 39 | "", 40 | "", 41 | "", 42 | "", 43 | "", 44 | "", 45 | "", 46 | "" 47 | ] 48 | }, 49 | "ios": { /* ios打包配置 */ 50 | 51 | }, 52 | "sdkConfigs": { /* SDK配置 */ 53 | 54 | } 55 | } 56 | }, 57 | "quickapp": { /* 快应用特有相关 */ 58 | 59 | }, 60 | "h5": { 61 | "optimization": { 62 | "treeShaking": { 63 | "enable": true 64 | } 65 | }, 66 | "router":{ 67 | "mode":"hash", 68 | "base":"/testProject/uniapp" 69 | } 70 | }, 71 | "mp-weixin": { /* 微信小程序特有相关 */ 72 | "appid": "wx9dcdaed5b2bc94ad", 73 | "setting": { 74 | "urlCheck": false 75 | }, 76 | "usingComponents": true 77 | }, 78 | "mp-alipay" : { 79 | "usingComponents" : true 80 | }, 81 | "mp-baidu" : { 82 | "usingComponents" : true 83 | }, 84 | "mp-toutiao" : { 85 | "usingComponents" : true 86 | }, 87 | "mp-qq" : { 88 | "usingComponents" : true 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /taro/src/components/card/card.jsx: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types' 2 | import Taro, { Component } from '@tarojs/taro' 3 | import { View, Text, Image } from '@tarojs/components' 4 | import './card.css' 5 | 6 | export default class Card extends Component { 7 | constructor(props) { 8 | super(props) 9 | this.state = { 10 | isActive: props.item.active || false 11 | } 12 | } 13 | 14 | trigger = () => { 15 | if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'alipay') { 16 | this.$scope && this.$scope.$perf && this.$scope.$perf.mark('setData') 17 | } 18 | this.setState({ 19 | isActive:!this.state.isActive 20 | }) 21 | } 22 | 23 | render() { 24 | let { item } = this.props 25 | let isActive = this.state.isActive 26 | let imgs = item.imgs.map((img,index)=>{ 27 | return ( 28 | 32 | 33 | 37 | 38 | 39 | ) 40 | }) 41 | 42 | return ( 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | {item.author_name} 55 | {item.published_at} {item.form} 56 | 57 | 58 | 59 | {item.content} 60 | 61 | {imgs} 62 | 63 | 64 | 65 | 66 | 67 | {item.share} 68 | 69 | 70 | 71 | 72 | {item.comment} 73 | 74 | 75 | 76 | 77 | {item.thumbs} 78 | 79 | 80 | 81 | 82 | ) 83 | } 84 | } 85 | 86 | Card.propTypes = { 87 | item: PropTypes.object 88 | } 89 | Card.defaultProps = { 90 | item: {} 91 | } 92 | -------------------------------------------------------------------------------- /kbone/build/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | const merge = require('webpack-merge') 4 | const baseWebpackConfig = require('./webpack.base.config') 5 | const HtmlWebpackPlugin = require('html-webpack-plugin') 6 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 7 | const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') 8 | const TerserPlugin = require('terser-webpack-plugin') 9 | const autoprefixer = require('autoprefixer') 10 | const {VueLoaderPlugin} = require('vue-loader') 11 | 12 | const webpackConfig = merge(baseWebpackConfig, { 13 | mode: 'production', 14 | output: { 15 | path: path.resolve(__dirname, '../dist/web'), 16 | filename: path.posix.join('static', 'js/[name].[chunkhash].js'), 17 | chunkFilename: path.posix.join('static', 'js/[id].[chunkhash].js') 18 | }, 19 | optimization: { 20 | splitChunks: { // 代码分割配置 21 | chunks: 'async', 22 | minSize: 30000, 23 | maxSize: 0, 24 | minChunks: 1, 25 | maxAsyncRequests: 5, 26 | maxInitialRequests: 3, 27 | automaticNameDelimiter: '~', 28 | name: true, 29 | cacheGroups: { 30 | vendors: { 31 | test: /[\\/]node_modules[\\/]/, 32 | priority: -10 33 | }, 34 | default: { 35 | minChunks: 2, 36 | priority: -20, 37 | reuseExistingChunk: true 38 | } 39 | } 40 | }, 41 | minimizer: [ 42 | // 压缩CSS 43 | new OptimizeCSSAssetsPlugin({ 44 | assetNameRegExp: /\.css$/g, 45 | cssProcessor: require('cssnano'), 46 | cssProcessorPluginOptions: { 47 | preset: ['default', { 48 | discardComments: { 49 | removeAll: true, 50 | }, 51 | }], 52 | }, 53 | canPrint: false 54 | }), 55 | // 压缩 js 56 | new TerserPlugin({ 57 | test: /\.js(\?.*)?$/i, 58 | parallel: true, 59 | }), 60 | ], 61 | }, 62 | devtool: false, 63 | module: { 64 | rules: [{ 65 | test: /\.(less|css)$/, 66 | use: [{ 67 | loader: MiniCssExtractPlugin.loader, 68 | }, { 69 | loader: 'css-loader', 70 | }, { 71 | loader: 'postcss-loader', 72 | options: { 73 | plugins: [ 74 | autoprefixer, 75 | ], 76 | } 77 | }, { 78 | loader: 'less-loader', 79 | }], 80 | }], 81 | }, 82 | plugins: [ 83 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 84 | new webpack.DefinePlugin({ 85 | 'process.env': { 86 | NODE_ENV: '"production"', 87 | }, 88 | }), 89 | new VueLoaderPlugin(), 90 | // 分离 css 文件 91 | new MiniCssExtractPlugin({ 92 | filename: path.posix.join('static', 'css/[name].[hash].css'), 93 | }), 94 | new HtmlWebpackPlugin({ 95 | filename: path.resolve(__dirname, '../dist/web/index.html'), 96 | template: 'index.html', 97 | inject: true, 98 | minify: { 99 | removeComments: true, 100 | collapseWhitespace: true, 101 | removeAttributeQuotes: true 102 | // 更多配置:https://github.com/kangax/html-minifier#options-quick-reference 103 | }, 104 | chunksSortMode: 'dependency' 105 | }), 106 | // 当 vendor 模块没有改变时,保证模块 id 不变 107 | new webpack.HashedModuleIdsPlugin(), 108 | ], 109 | }) 110 | 111 | module.exports = webpackConfig 112 | -------------------------------------------------------------------------------- /taro-next/src/components/card/card.jsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | /* eslint-disable react/react-in-jsx-scope */ 3 | import PropTypes from 'prop-types' 4 | import React, { Component } from 'react' 5 | import { View, Text, Image } from '@tarojs/components' 6 | import './card.css' 7 | 8 | export default class Card extends Component { 9 | constructor(props) { 10 | super(props) 11 | this.state = { 12 | isActive: props.item.active || false 13 | } 14 | } 15 | 16 | trigger = () => { 17 | let pages = getCurrentPages() 18 | pages = pages[pages.length -1] 19 | if (process.env.TARO_ENV === 'weapp') { 20 | pages.$perf && pages.$perf.mark('setData',this) 21 | } 22 | this.setState((state)=>{ 23 | return { 24 | isActive:!state.isActive 25 | } 26 | }) 27 | } 28 | 29 | render() { 30 | let { item } = this.props 31 | let isActive = this.state.isActive 32 | let imgs = item.imgs.map((img,index)=>{ 33 | return ( 34 | 38 | 39 | 43 | 44 | 45 | ) 46 | }) 47 | 48 | return ( 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | {item.author_name} 61 | {item.published_at} {item.form} 62 | 63 | 64 | 65 | {item.content} 66 | 67 | {imgs} 68 | 69 | 70 | 71 | 72 | 73 | {item.share} 74 | 75 | 76 | 77 | 78 | {item.comment} 79 | 80 | 81 | 82 | 83 | {item.thumbs} 84 | 85 | 86 | 87 | 88 | ) 89 | } 90 | } 91 | 92 | Card.propTypes = { 93 | item: PropTypes.object 94 | } 95 | Card.defaultProps = { 96 | item: {} 97 | } 98 | -------------------------------------------------------------------------------- /uni-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uni-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "npm run dev:h5", 7 | "build": "npm run build:h5", 8 | "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", 9 | "build:custom": "cross-env NODE_ENV=production uniapp-cli custom", 10 | "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build", 11 | "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build", 12 | "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build", 13 | "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build", 14 | "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build", 15 | "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build", 16 | "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch", 17 | "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom", 18 | "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve", 19 | "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch", 20 | "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch", 21 | "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch", 22 | "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch", 23 | "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", 24 | "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js" 25 | }, 26 | "dependencies": { 27 | "@dcloudio/uni-app-plus": "^2.0.0-26520200314001", 28 | "@dcloudio/uni-h5": "^2.0.0-26520200314001", 29 | "@dcloudio/uni-helper-json": "*", 30 | "@dcloudio/uni-mp-alipay": "^2.0.0-26520200314001", 31 | "@dcloudio/uni-mp-baidu": "^2.0.0-26520200314001", 32 | "@dcloudio/uni-mp-qq": "^2.0.0-26520200314001", 33 | "@dcloudio/uni-mp-toutiao": "^2.0.0-26520200314001", 34 | "@dcloudio/uni-mp-weixin": "^2.0.0-26520200314001", 35 | "@dcloudio/uni-stat": "^2.0.0-26520200314001", 36 | "flyio": "^0.6.2", 37 | "regenerator-runtime": "^0.12.1", 38 | "vue": "^2.6.11", 39 | "vuex": "^3.0.1" 40 | }, 41 | "devDependencies": { 42 | "@dcloudio/uni-cli-shared": "^2.0.0-26520200314001", 43 | "@dcloudio/uni-migration": "^2.0.0-26520200314001", 44 | "@dcloudio/uni-template-compiler": "^2.0.0-26520200314001", 45 | "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.0-26520200314001", 46 | "@dcloudio/vue-cli-plugin-uni": "^2.0.0-26520200314001", 47 | "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-26520200314001", 48 | "@dcloudio/webpack-uni-mp-loader": "^2.0.0-26520200314001", 49 | "@dcloudio/webpack-uni-pages-loader": "^2.0.0-26520200314001", 50 | "@types/html5plus": "*", 51 | "@types/uni-app": "*", 52 | "@vue/cli-plugin-babel": "3.5.1", 53 | "@vue/cli-service": "^4.2.0", 54 | "babel-plugin-import": "^1.11.0", 55 | "mini-types": "*", 56 | "miniprogram-api-typings": "^2.8.0-2", 57 | "postcss-comment": "^2.0.0", 58 | "vue-template-compiler": "^2.6.11" 59 | }, 60 | "browserslist": [ 61 | "Android >= 4", 62 | "ios >= 8" 63 | ], 64 | "uni-app": { 65 | "scripts": {} 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /uni-app-v3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uni-app-vue3", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "npm run dev:h5", 7 | "build": "npm run build:h5", 8 | "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", 9 | "build:custom": "cross-env NODE_ENV=production uniapp-cli custom", 10 | "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build", 11 | "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build", 12 | "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build", 13 | "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build", 14 | "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build", 15 | "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build", 16 | "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch", 17 | "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom", 18 | "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve", 19 | "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch", 20 | "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch", 21 | "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch", 22 | "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch", 23 | "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", 24 | "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js" 25 | }, 26 | "dependencies": { 27 | "@dcloudio/uni-app-plus": "^2.0.0-26520200314001", 28 | "@dcloudio/uni-h5": "^2.0.0-26520200314001", 29 | "@dcloudio/uni-helper-json": "*", 30 | "@dcloudio/uni-mp-alipay": "^2.0.0-26520200314001", 31 | "@dcloudio/uni-mp-baidu": "^2.0.0-26520200314001", 32 | "@dcloudio/uni-mp-qq": "^2.0.0-26520200314001", 33 | "@dcloudio/uni-mp-toutiao": "^2.0.0-26520200314001", 34 | "@dcloudio/uni-mp-weixin": "^2.0.0-26520200314001", 35 | "@dcloudio/uni-stat": "^2.0.0-26520200314001", 36 | "flyio": "^0.6.2", 37 | "regenerator-runtime": "^0.12.1", 38 | "vue": "^2.6.11", 39 | "vuex": "^3.0.1" 40 | }, 41 | "devDependencies": { 42 | "@dcloudio/uni-cli-shared": "^2.0.0-26520200314001", 43 | "@dcloudio/uni-migration": "^2.0.0-26520200314001", 44 | "@dcloudio/uni-template-compiler": "^2.0.0-26520200314001", 45 | "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.0-26520200314001", 46 | "@dcloudio/vue-cli-plugin-uni": "^2.0.0-26520200314001", 47 | "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-26520200314001", 48 | "@dcloudio/webpack-uni-mp-loader": "^2.0.0-26520200314001", 49 | "@dcloudio/webpack-uni-pages-loader": "^2.0.0-26520200314001", 50 | "@types/html5plus": "*", 51 | "@types/uni-app": "*", 52 | "@vue/cli-plugin-babel": "3.5.1", 53 | "@vue/cli-service": "^4.2.0", 54 | "babel-plugin-import": "^1.11.0", 55 | "mini-types": "*", 56 | "miniprogram-api-typings": "^2.8.0-2", 57 | "postcss-comment": "^2.0.0", 58 | "vue-template-compiler": "^2.6.11" 59 | }, 60 | "browserslist": [ 61 | "Android >= 4", 62 | "ios >= 8" 63 | ], 64 | "uni-app": { 65 | "scripts": {} 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /mpvue/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var fs = require('fs') 3 | var config = require('../config') 4 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | var mpvueInfo = require('../node_modules/mpvue/package.json') 6 | var packageInfo = require('../package.json') 7 | var mkdirp = require('mkdirp') 8 | 9 | exports.assetsPath = function (_path) { 10 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 11 | ? config.build.assetsSubDirectory 12 | : config.dev.assetsSubDirectory 13 | return path.posix.join(assetsSubDirectory, _path) 14 | } 15 | 16 | exports.cssLoaders = function (options) { 17 | options = options || {} 18 | 19 | var cssLoader = { 20 | loader: 'css-loader', 21 | options: { 22 | minimize: process.env.NODE_ENV === 'production', 23 | sourceMap: options.sourceMap 24 | } 25 | } 26 | 27 | var postcssLoader = { 28 | loader: 'postcss-loader', 29 | options: { 30 | sourceMap: true 31 | } 32 | } 33 | 34 | var px2rpxLoader = { 35 | loader: 'px2rpx-loader', 36 | options: { 37 | baseDpr: 1, 38 | rpxUnit: 0.5 39 | } 40 | } 41 | 42 | // generate loader string to be used with extract text plugin 43 | function generateLoaders (loader, loaderOptions) { 44 | var loaders = [cssLoader, px2rpxLoader, postcssLoader] 45 | if (loader) { 46 | loaders.push({ 47 | loader: loader + '-loader', 48 | options: Object.assign({}, loaderOptions, { 49 | sourceMap: options.sourceMap 50 | }) 51 | }) 52 | } 53 | 54 | // Extract CSS when that option is specified 55 | // (which is the case during production build) 56 | if (options.extract) { 57 | return ExtractTextPlugin.extract({ 58 | use: loaders, 59 | fallback: 'vue-style-loader' 60 | }) 61 | } else { 62 | return ['vue-style-loader'].concat(loaders) 63 | } 64 | } 65 | 66 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 67 | return { 68 | css: generateLoaders(), 69 | wxss: generateLoaders(), 70 | postcss: generateLoaders(), 71 | less: generateLoaders('less'), 72 | sass: generateLoaders('sass', { indentedSyntax: true }), 73 | scss: generateLoaders('sass'), 74 | stylus: generateLoaders('stylus'), 75 | styl: generateLoaders('stylus') 76 | } 77 | } 78 | 79 | // Generate loaders for standalone style files (outside of .vue) 80 | exports.styleLoaders = function (options) { 81 | var output = [] 82 | var loaders = exports.cssLoaders(options) 83 | for (var extension in loaders) { 84 | var loader = loaders[extension] 85 | output.push({ 86 | test: new RegExp('\\.' + extension + '$'), 87 | use: loader 88 | }) 89 | } 90 | return output 91 | } 92 | 93 | const writeFile = async (filePath, content) => { 94 | let dir = path.dirname(filePath) 95 | let exist = fs.existsSync(dir) 96 | if (!exist) { 97 | await mkdirp(dir) 98 | } 99 | await fs.writeFileSync(filePath, content, 'utf8') 100 | } 101 | 102 | exports.writeFrameworkinfo = function () { 103 | var buildInfo = { 104 | 'toolName': mpvueInfo.name, 105 | 'toolFrameWorkVersion': mpvueInfo.version, 106 | 'toolCliVersion': packageInfo.mpvueTemplateProjectVersion || '', 107 | 'createTime': Date.now() 108 | } 109 | 110 | var content = JSON.stringify(buildInfo) 111 | var fileName = '.frameworkinfo' 112 | var rootDir = path.resolve(__dirname, `../${fileName}`) 113 | var distDir = path.resolve(config.build.assetsRoot, `./${fileName}`) 114 | 115 | writeFile(rootDir, content) 116 | writeFile(distDir, content) 117 | } 118 | -------------------------------------------------------------------------------- /chameleon/npm-shrinkwrap.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleontest", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "chameleon-api": { 8 | "version": "0.1.0", 9 | "resolved": "https://registry.npmjs.org/chameleon-api/-/chameleon-api-0.1.0.tgz", 10 | "integrity": "sha512-3voN7q29/mApCpH4D58dQds2GjmhI7s1DbBpsdg46yKwMHYwW2B7dr6KyVNecnjOHU1fCRs+lgxyB7n4/voQ4Q==", 11 | "requires": { 12 | "chameleon-bridge": "0.1.0", 13 | "fetch-detector": "^1.0.1", 14 | "fetch-ie8": "^1.5.0" 15 | } 16 | }, 17 | "chameleon-bridge": { 18 | "version": "0.1.0", 19 | "resolved": "https://registry.npmjs.org/chameleon-bridge/-/chameleon-bridge-0.1.0.tgz", 20 | "integrity": "sha512-1Qc7F4ts0zlfglGn3VnVSPg3SRge37gu5/EQ+Mz8K3vqpRgoXGPN6cRtK+4wrvqox740gml+yWsuV10GY2xB1A==" 21 | }, 22 | "chameleon-runtime": { 23 | "version": "0.0.3", 24 | "resolved": "https://registry.npmjs.org/chameleon-runtime/-/chameleon-runtime-0.0.3.tgz", 25 | "integrity": "sha512-4BZHXmpFPI6+oHvooOf1IcAD5BkjOFwLKSD3/EcL2k9PbZ8m4XZaxdyMwuErdci24c1cgJEcINivOYg4HztbsA==", 26 | "requires": { 27 | "mobx": "3.6.1" 28 | } 29 | }, 30 | "chameleon-scroll": { 31 | "version": "0.0.1", 32 | "resolved": "https://registry.npmjs.org/chameleon-scroll/-/chameleon-scroll-0.0.1.tgz", 33 | "integrity": "sha512-kpsab4j7dn0dpTseb60Pz8Qz1V7nc/UsElYixaK+n6MQxkCKoHKs25DHZ/4xH2rsWXqnPbAd7Je02zeFkKo7jw==" 34 | }, 35 | "chameleon-store": { 36 | "version": "0.0.3", 37 | "resolved": "https://registry.npmjs.org/chameleon-store/-/chameleon-store-0.0.3.tgz", 38 | "integrity": "sha512-f6lmeDW01xnau71iXK52haomD2etmQg+gBvVFO5T84eqs9AxtXiRkYAjxl/rqu+ejFACAm1nWMfAjXldw0lUTQ==", 39 | "requires": { 40 | "mobx": "3.6.1", 41 | "vuex": "3.0.1" 42 | } 43 | }, 44 | "chameleon-ui-builtin": { 45 | "version": "0.0.6", 46 | "resolved": "https://registry.npmjs.org/chameleon-ui-builtin/-/chameleon-ui-builtin-0.0.6.tgz", 47 | "integrity": "sha512-UwAxxaHdurksKX0m4czx8OjmaBdJZSXs5idVcWh35Zm4JPeHLsusRYQx6UTRCFneJaKwIAYF60TEUotPFBtzNQ==", 48 | "requires": { 49 | "chameleon-scroll": "0.0.1" 50 | } 51 | }, 52 | "classnames": { 53 | "version": "2.2.6", 54 | "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", 55 | "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" 56 | }, 57 | "cml-ui": { 58 | "version": "0.0.6", 59 | "resolved": "https://registry.npmjs.org/cml-ui/-/cml-ui-0.0.6.tgz", 60 | "integrity": "sha512-6Dq+h4AnCYAevIWbJE6EOLobAA1Q78eqvl9BRngRIK7/vmMwU0UYBTd3g72c9G+y42bxGBGlfrcZWKs7PqcP0A==", 61 | "requires": { 62 | "classnames": "2.2.6" 63 | } 64 | }, 65 | "fetch-detector": { 66 | "version": "1.0.1", 67 | "resolved": "https://registry.npmjs.org/fetch-detector/-/fetch-detector-1.0.1.tgz", 68 | "integrity": "sha1-bLPq9zjCcnhi6GiA1hIUI+qkIIM=" 69 | }, 70 | "fetch-ie8": { 71 | "version": "1.5.0", 72 | "resolved": "https://registry.npmjs.org/fetch-ie8/-/fetch-ie8-1.5.0.tgz", 73 | "integrity": "sha1-8RQcP5bLyJN6oxsPvBp3AiD7wVs=" 74 | }, 75 | "mobx": { 76 | "version": "3.6.1", 77 | "resolved": "https://registry.npmjs.org/mobx/-/mobx-3.6.1.tgz", 78 | "integrity": "sha1-rmOo8A4UhadA0Pka4val9o4wO+o=" 79 | }, 80 | "vuex": { 81 | "version": "3.0.1", 82 | "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.0.1.tgz", 83 | "integrity": "sha512-wLoqz0B7DSZtgbWL1ShIBBCjv22GV5U+vcBFox658g6V0s4wZV9P4YjCNyoHSyIBpj1f29JBoNQIqD82cR4O3w==" 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /mpvue/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.PLATFORM = process.argv[process.argv.length - 1] || 'wx' 4 | var config = require('../config') 5 | if (!process.env.NODE_ENV) { 6 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 7 | } 8 | 9 | // var opn = require('opn') 10 | var path = require('path') 11 | var express = require('express') 12 | var webpack = require('webpack') 13 | var proxyMiddleware = require('http-proxy-middleware') 14 | var portfinder = require('portfinder') 15 | var webpackConfig = require('./webpack.dev.conf') 16 | var utils = require('./utils') 17 | 18 | // default port where dev server listens for incoming traffic 19 | var port = process.env.PORT || config.dev.port 20 | // automatically open browser, if not set will be false 21 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 22 | // Define HTTP proxies to your custom API backend 23 | // https://github.com/chimurai/http-proxy-middleware 24 | var proxyTable = config.dev.proxyTable 25 | 26 | var app = express() 27 | var compiler = webpack(webpackConfig) 28 | if (process.env.PLATFORM === 'swan') { 29 | utils.writeFrameworkinfo() 30 | } 31 | 32 | // var devMiddleware = require('webpack-dev-middleware')(compiler, { 33 | // publicPath: webpackConfig.output.publicPath, 34 | // quiet: true 35 | // }) 36 | 37 | // var hotMiddleware = require('webpack-hot-middleware')(compiler, { 38 | // log: false, 39 | // heartbeat: 2000 40 | // }) 41 | // force page reload when html-webpack-plugin template changes 42 | // compiler.plugin('compilation', function (compilation) { 43 | // compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 44 | // hotMiddleware.publish({ action: 'reload' }) 45 | // cb() 46 | // }) 47 | // }) 48 | 49 | // proxy api requests 50 | Object.keys(proxyTable).forEach(function (context) { 51 | var options = proxyTable[context] 52 | if (typeof options === 'string') { 53 | options = { target: options } 54 | } 55 | app.use(proxyMiddleware(options.filter || context, options)) 56 | }) 57 | 58 | // handle fallback for HTML5 history API 59 | app.use(require('connect-history-api-fallback')()) 60 | 61 | // serve webpack bundle output 62 | // app.use(devMiddleware) 63 | 64 | // enable hot-reload and state-preserving 65 | // compilation error display 66 | // app.use(hotMiddleware) 67 | 68 | // serve pure static assets 69 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 70 | app.use(staticPath, express.static('./static')) 71 | 72 | // var uri = 'http://localhost:' + port 73 | 74 | var _resolve 75 | var readyPromise = new Promise(resolve => { 76 | _resolve = resolve 77 | }) 78 | 79 | // console.log('> Starting dev server...') 80 | // devMiddleware.waitUntilValid(() => { 81 | // console.log('> Listening at ' + uri + '\n') 82 | // // when env is testing, don't need open it 83 | // if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 84 | // opn(uri) 85 | // } 86 | // _resolve() 87 | // }) 88 | 89 | module.exports = new Promise((resolve, reject) => { 90 | portfinder.basePort = port 91 | portfinder.getPortPromise() 92 | .then(newPort => { 93 | if (port !== newPort) { 94 | console.log(`${port}端口被占用,开启新端口${newPort}`) 95 | } 96 | var server = app.listen(newPort, 'localhost') 97 | // for 小程序的文件保存机制 98 | require('webpack-dev-middleware-hard-disk')(compiler, { 99 | publicPath: webpackConfig.output.publicPath, 100 | quiet: true 101 | }) 102 | resolve({ 103 | ready: readyPromise, 104 | close: () => { 105 | server.close() 106 | } 107 | }) 108 | }).catch(error => { 109 | console.log('没有找到空闲端口,请打开任务管理器杀死进程端口再试', error) 110 | }) 111 | }) 112 | -------------------------------------------------------------------------------- /mpvue/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var fs = require('fs') 3 | var utils = require('./utils') 4 | var config = require('../config') 5 | var webpack = require('webpack') 6 | var merge = require('webpack-merge') 7 | var vueLoaderConfig = require('./vue-loader.conf') 8 | var MpvuePlugin = require('webpack-mpvue-asset-plugin') 9 | var glob = require('glob') 10 | var CopyWebpackPlugin = require('copy-webpack-plugin') 11 | var relative = require('relative') 12 | 13 | function resolve (dir) { 14 | return path.join(__dirname, '..', dir) 15 | } 16 | 17 | function getEntry (rootSrc) { 18 | var map = {}; 19 | glob.sync(rootSrc + '/pages/**/main.js') 20 | .forEach(file => { 21 | var key = relative(rootSrc, file).replace('.js', ''); 22 | map[key] = file; 23 | }) 24 | return map; 25 | } 26 | 27 | const appEntry = { app: resolve('./src/main.js') } 28 | const pagesEntry = getEntry(resolve('./src'), 'pages/**/main.js') 29 | const entry = Object.assign({}, appEntry, pagesEntry) 30 | 31 | let baseWebpackConfig = { 32 | // 如果要自定义生成的 dist 目录里面的文件路径, 33 | // 可以将 entry 写成 {'toPath': 'fromPath'} 的形式, 34 | // toPath 为相对于 dist 的路径, 例:index/demo,则生成的文件地址为 dist/index/demo.js 35 | entry, 36 | target: require('mpvue-webpack-target'), 37 | output: { 38 | path: config.build.assetsRoot, 39 | jsonpFunction: 'webpackJsonpMpvue', 40 | filename: '[name].js', 41 | publicPath: process.env.NODE_ENV === 'production' 42 | ? config.build.assetsPublicPath 43 | : config.dev.assetsPublicPath 44 | }, 45 | resolve: { 46 | extensions: ['.js', '.vue', '.json'], 47 | alias: { 48 | 'vue': 'mpvue', 49 | '@': resolve('src') 50 | }, 51 | symlinks: false, 52 | aliasFields: ['mpvue', 'weapp', 'browser'], 53 | mainFields: ['browser', 'module', 'main'] 54 | }, 55 | module: { 56 | rules: [ 57 | { 58 | test: /\.vue$/, 59 | loader: 'mpvue-loader', 60 | options: vueLoaderConfig 61 | }, 62 | { 63 | test: /\.js$/, 64 | include: [resolve('src'), resolve('test')], 65 | use: [ 66 | 'babel-loader', 67 | { 68 | loader: 'mpvue-loader', 69 | options: Object.assign({checkMPEntry: true}, vueLoaderConfig) 70 | }, 71 | ] 72 | }, 73 | { 74 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 75 | loader: 'url-loader', 76 | options: { 77 | limit: 10000, 78 | name: utils.assetsPath('img/[name].[ext]') 79 | } 80 | }, 81 | { 82 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 83 | loader: 'url-loader', 84 | options: { 85 | limit: 10000, 86 | name: utils.assetsPath('media/[name].[ext]') 87 | } 88 | }, 89 | { 90 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 91 | loader: 'url-loader', 92 | options: { 93 | limit: 10000, 94 | name: utils.assetsPath('fonts/[name].[ext]') 95 | } 96 | } 97 | ] 98 | }, 99 | plugins: [ 100 | // api 统一桥协议方案 101 | new webpack.DefinePlugin({ 102 | 'mpvue': 'global.mpvue', 103 | 'mpvuePlatform': 'global.mpvuePlatform' 104 | }), 105 | new MpvuePlugin(), 106 | new CopyWebpackPlugin([{ 107 | from: '**/*.json', 108 | to: '' 109 | }], { 110 | context: 'src/' 111 | }), 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: path.resolve(config.build.assetsRoot, './static'), 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | } 121 | 122 | // 针对百度小程序,由于不支持通过 miniprogramRoot 进行自定义构建完的文件的根路径 123 | // 所以需要将项目根路径下面的 project.swan.json 拷贝到构建目录 124 | // 然后百度开发者工具将 dist/swan 作为项目根目录打 125 | const projectConfigMap = { 126 | tt: '../project.config.json', 127 | swan: '../project.swan.json' 128 | } 129 | 130 | const PLATFORM = process.env.PLATFORM 131 | if (/^(swan)|(tt)$/.test(PLATFORM)) { 132 | baseWebpackConfig = merge(baseWebpackConfig, { 133 | plugins: [ 134 | new CopyWebpackPlugin([{ 135 | from: path.resolve(__dirname, projectConfigMap[PLATFORM]), 136 | to: path.resolve(config.build.assetsRoot) 137 | }]) 138 | ] 139 | }) 140 | } 141 | 142 | module.exports = baseWebpackConfig 143 | --------------------------------------------------------------------------------