提交 8c83c618 编写于 作者: fxy060608's avatar fxy060608

refactor: quickapp=>quickapp-vue

上级 a2b886ba
......@@ -8,7 +8,7 @@ const genConfig = require('./rollup.config.qa')
const filename = 'vue.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev') + '.js'
async function build () {
async function build() {
const bridgeBundle = await rollup.rollup(genConfig('bridge'))
const {
output: bridgeOutput
......@@ -51,22 +51,22 @@ dsl.onInitApp(function({
});`
})
const pageCode = pageOutput[0].code
const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp/assets/' + filename))
const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp-vue/assets/' + filename))
fs.writeFileSync(
path.resolve(__dirname, '../packages/uni-quickapp/dist/' + filename),
path.resolve(__dirname, '../packages/uni-quickapp-vue/dist/' + filename),
vueCode + bridgeCode + appCode + pageCode, {
encoding: 'utf8'
}
)
if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy
const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp/view/components/**/*')
const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp/components')
const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-vue/view/components/**/*')
const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-vue/components')
del.sync([componentsDest])
copy(componentsSrc, componentsDest, function (err, file) {
copy(componentsSrc, componentsDest, function(err, file) {
if (err) {
throw err
}
......
......@@ -6,13 +6,13 @@ const commonjs = require('rollup-plugin-commonjs')
const terser = require('rollup-plugin-terser')
const requireContext = require('../lib/rollup-plugin-require-context')
process.env.UNI_PLATFORM = 'quickapp'
process.env.UNI_PLATFORM = 'quickapp-vue'
const external = []
const resolve = dir => path.resolve(__dirname, '../', dir)
function replaceModuleImport (str) {
function replaceModuleImport(str) {
return str.replace(
/require\s*\(\s*(['"])@([\w$_][\w$-.]*?)\1\)/gm,
(e, r, p) => `$app_require$(${r}@app-module/${p}${r})`
......@@ -23,45 +23,45 @@ function replaceModuleImport (str) {
}
const plugins = [{
name: 'replaceModuleImport',
transform (source) {
return {
code: replaceModuleImport(source)
name: 'replaceModuleImport',
transform(source) {
return {
code: replaceModuleImport(source)
}
}
}
},
alias({
'uni-core': resolve('src/core'),
'uni-platform': resolve('src/platforms/' + process.env.UNI_PLATFORM),
'uni-platforms': resolve('src/platforms'),
'uni-shared': resolve('src/shared/index.js'),
'uni-helpers': resolve('src/core/helpers'),
'uni-invoke-api': resolve('src/platforms/quickapp/service/invoke-api'),
'uni-service-api': resolve('src/platforms/quickapp/service/api'),
'uni-api-protocol': resolve('src/core/helpers/protocol')
}),
nodeResolve(),
requireContext(),
commonjs(),
replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用'
})
},
alias({
'uni-core': resolve('src/core'),
'uni-platform': resolve('src/platforms/quickapp-vue'),
'uni-platforms': resolve('src/platforms'),
'uni-shared': resolve('src/shared/index.js'),
'uni-helpers': resolve('src/core/helpers'),
'uni-invoke-api': resolve('src/platforms/quickapp-vue/service/invoke-api'),
'uni-service-api': resolve('src/platforms/quickapp-vue/service/api'),
'uni-api-protocol': resolve('src/core/helpers/protocol')
}),
nodeResolve(),
requireContext(),
commonjs(),
replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用(Vue)版'
})
]
// if (process.env.NODE_ENV === 'production') {
plugins.push(terser.terser())
// }
module.exports = function (type) {
module.exports = function(type) {
let input = ''
if (type === 'bridge') {
input = 'src/platforms/quickapp/runtime/bridge.js'
input = 'src/platforms/quickapp-vue/runtime/bridge.js'
} else if (type === 'app') {
input = 'src/platforms/quickapp/runtime/app.js'
input = 'src/platforms/quickapp-vue/runtime/app.js'
} else if (type === 'page') {
input = 'src/platforms/quickapp/runtime/page.js'
input = 'src/platforms/quickapp-vue/runtime/page.js'
}
return {
......
......@@ -26,7 +26,7 @@
"build:quickapp-light": "cross-env UNI_PLATFORM=quickapp-light rollup -c build/rollup.config.mp.js",
"build:mp-weixin:mp": "npm run lint && cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js",
"build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js",
"build:quickapp": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js",
"build:quickapp-vue": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js",
"build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus",
"build:stat": "npm run lint && rollup -c build/rollup.config.stat.js",
"build:web-view": "npm run lint && rollup -c build/rollup.config.web-view.js",
......
<template>
<div v-on="$listeners">
<text>
<div
:class="viewClass"
class="uni-button"
v-on="$listeners">
<text
:class="textClass"
class="uni-button-t">
<slot />
</text>
</div>
</template>
<script>
<script>
const BUTTON_TYPES = {
default: 'd',
primary: 'p',
warn: 'w'
}
export default {
name: 'Button'
name: 'Button',
props: {
hoverClass: {
type: String,
default: 'button-hover'
},
disabled: {
type: [Boolean, String],
default: false
},
id: {
type: String,
default: ''
},
type: {
type: String,
default: 'default'
},
size: {
type: String,
default: 'default'
},
plain: {
type: [Boolean, String],
default: false
},
loading: {
type: [Boolean, String],
default: false
},
hoverStopPropagation: {
type: Boolean,
default: false
},
hoverStartTime: {
type: Number,
default: 20
},
hoverStayTime: {
type: Number,
default: 70
},
openType: {
type: String,
default: ''
},
formType: {
type: String,
default: '',
validator: function validator (value) {
return ~['', 'submit', 'reset'].indexOf(value)
}
}
},
computed: {
viewClass () {
return this._getClass('')
},
textClass () {
return this._getClass('-t')
}
},
methods: {
_onClick ($event, isLabelClick) {
if (this.disabled) {
return
}
if (isLabelClick) {
this.$el.click()
}
if (this.formType) {
this.$dispatch('Form', this.formType === 'submit' ? 'uni-form-submit' : 'uni-form-reset', {
type: this.formType
}, this)
}
},
_getClass (t) {
let cl = 'uni-button-' + BUTTON_TYPES[this.type] + t
if (this.disabled) {
cl += '-d'
}
if (this.plain) {
cl += '-plain'
}
if (t === '-t' && this.size === 'mini') {
cl += ' uni-button-mini'
}
return cl
},
_getHoverClass (t) {
if (this.disabled) {
return ''
}
let cl = 'uni-button-' + BUTTON_TYPES[this.type] + t + '-hover'
if (this.plain) {
cl += '-plain'
}
return cl
}
}
}
</script>
<style>
<style>
.uni-button {
flex-direction: row;
align-items: center;
justify-content: center;
position: relative;
padding-left: 5px;
padding-right: 5px;
overflow: hidden;
color: #000000;
background-color: #f8f8f8;
border-radius: 5px;
border-style: solid;
border-width: 1px;
border-color: #dbdbdb;
}
.uni-button-t {
color: #000000;
font-size: 18px;
text-decoration: none;
line-height: 46px;
}
.uni-button-d {
background-color: #f8f8f8;
}
.uni-button-p {
background-color: #007aff;
border-color: #0062cc;
}
.uni-button-w {
background-color: #e64340;
border-color: #b83633;
}
.uni-button-d-t {
color: #000000;
}
.uni-button-p-t {
color: #ffffff;
}
.uni-button-w-t {
color: #ffffff;
}
.uni-button-d-d {
background-color: #f7f7f7;
}
.uni-button-p-d {
background-color: #63acfc;
border-color: #4f8aca;
}
.uni-button-w-d {
background-color: #ec8b89;
border-color: #bd6f6e;
}
.uni-button-d-t-d {
color: #cccccc;
}
.uni-button-p-t-d {
color: rgba(255,255,255,0.6);
}
.uni-button-w-t-d {
color: rgba(255,255,255,0.6);
}
.uni-button-d-plain {
border-color: #353535;
background-color: rgba(0,0,0,0);
}
.uni-button-p-plain {
border-color: #007aff;
background-color: rgba(0,0,0,0);
}
.uni-button-w-plain {
border-color: #e64340;
background-color: rgba(0,0,0,0);
}
.uni-button-d-t-plain {
color: #353535;
}
.uni-button-p-t-plain {
color: #007aff;
}
.uni-button-w-t-plain {
color: #e64340;
}
.uni-button-d-d-plain {
border-color: #c6c6c6;
background-color: rgba(0,0,0,0);
}
.uni-button-p-d-plain {
border-color: #c6c6c6;
background-color: rgba(0,0,0,0);
}
.uni-button-w-d-plain {
border-color: #c6c6c6;
background-color: rgba(0,0,0,0);
}
.uni-button-d-t-d-plain {
color: rgba(0,0,0,0.2);
}
.uni-button-p-t-d-plain {
color: rgba(0,0,0,0.2);
}
.uni-button-w-t-d-plain {
color: rgba(0,0,0,0.2);
}
.uni-button-mini {
line-height: 30px;
font-size: 13px;
padding-top: 0;
padding-right: 17.5px;
padding-bottom: 0;
padding-left: 17.5px;
}
.uni-button-loading {
width: 18px;
height: 18px;
margin-right: 10px;
}
.uni-button-d-loading {
color: rgba(255,255,255,0.6);
background-color: rgba(0,0,0,0);
}
.uni-button-p-loading {
color: rgba(255,255,255,0.6);
background-color: rgba(0,0,0,0);
}
.uni-button-w-loading {
color: rgba(255,255,255,0.6);
background-color: #ce3c39;
}
.uni-button-d-loading-plain {
color: #353535;
}
.uni-button-p-loading-plain {
color: #007aff;
background-color: #0062cc;
}
.uni-button-w-loading-plain {
color: #e64340;
background-color: rgba(0,0,0,0);
}
.uni-button-d-hover {
opacity: 0.8;
background-color: #dedede;
}
.uni-button-p-hover {
opacity: 0.8;
background-color: #0062cc;
}
.uni-button-w-hover {
opacity: 0.8;
backgroundColor: #ce3c39;
}
.uni-button-d-t-hover {
color: rgba(0,0,0,0.6);
}
.uni-button-p-t-hover {
color: rgba(255,255,255,0.6);
}
.uni-button-w-t-hover {
color: rgba(255,255,255,0.6);
}
.uni-button-d-hover-plain {
color: rgba(53,53,53,0.6);
border-color: rgba(53,53,53,0.6);
background-color: rgba(0,0,0,0);
}
.uni-button-p-hover-plain {
color: rgba(26,173,25,0.6);
border-color: rgba(0,122,255,0.6);
background-color: rgba(0,0,0,0);
}
.uni-button-w-hover-plain {
color: rgba(230,67,64,0.6);
border-color: rgba(230,67,64,0.6);
background-color: rgba(0,0,0,0);
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册