提交 e8339526 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -113,7 +113,7 @@ global.onAppShow = function(){};
` : ''
return {
devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
devtool: process.env.NODE_ENV === 'production' ? false : 'cheap-module-eval-source-map',
resolve: {
extensions: ['.nvue'],
alias: {
......
......@@ -17,7 +17,7 @@ const {
} = require('@dcloudio/uni-cli-shared/lib/cache')
const {
pagesJsonJsFileName,
// pagesJsonJsFileName,
initAutoImportComponents
} = require('@dcloudio/uni-cli-shared/lib/pages')
......@@ -41,11 +41,11 @@ module.exports = function (content) {
isAppView = params.type === 'view'
}
const pagesJsonJsPath = path.resolve(process.env.UNI_INPUT_DIR, pagesJsonJsFileName)
// const pagesJsonJsPath = path.resolve(process.env.UNI_INPUT_DIR, pagesJsonJsFileName)
const manifestJsonPath = path.resolve(process.env.UNI_INPUT_DIR, 'manifest.json')
const manifestJson = parseManifestJson(fs.readFileSync(manifestJsonPath, 'utf8'))
this.addDependency(pagesJsonJsPath)
// this.addDependency(pagesJsonJsPath)
this.addDependency(manifestJsonPath)
const pagesJson = parsePagesJson(content, {
......
<template>
<uni-cover-view
v-on="$listeners">
<div
ref="container"
class="uni-cover-view"/>
</uni-cover-view>
</template>
<script>
import native from '../../mixins/native'
import cover from '../../mixins/cover'
......@@ -20,20 +12,23 @@ export default {
coverContent: ''
}
},
watch: {},
mounted () {
this._updateContent()
this.$watch('$slot', this._updateContent)
},
methods: {
_updateContent (val) {
const $slots = this.$slots.default || []
$slots.forEach(node => {
if (!node.tag) {
this.coverContent += node.text || ''
}
})
}
render (createElement) {
let coverContent = ''
const $slots = this.$slots.default || []
$slots.forEach(node => {
if (!node.tag) {
coverContent += node.text || ''
}
})
this.coverContent = coverContent
return createElement('uni-cover-view', {
on: {
on: this.$listeners
}
}, [createElement('div', {
ref: 'container',
staticClass: 'uni-cover-view'
}, [coverContent])])
}
}
</script>
......
const base = ['padding', 'borderRadius', 'borderColor', 'borderWidth', 'backgroundColor']
const text = ['color', 'textAlign', 'lineHeight', 'fontSize', 'fontWeight', 'textOverflow', 'whiteSpace']
const base = ['borderRadius', 'borderColor', 'borderWidth', 'backgroundColor']
const text = ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'color', 'textAlign', 'lineHeight', 'fontSize', 'fontWeight', 'textOverflow', 'whiteSpace']
const image = []
const textAlign = { start: 'left', end: 'right' }
let index = 0
......@@ -35,30 +35,42 @@ export default {
tags () {
const position = this._getTagPosition()
const style = this.style
return [
{
tag: 'rect',
position,
rectStyles: {
color: style.backgroundColor,
radius: style.borderRadius,
borderColor: style.borderColor,
borderWidth: style.borderWidth
}
},
this.coverType === 'image' ? {
const tags = [{
tag: 'rect',
position,
rectStyles: {
color: style.backgroundColor,
radius: style.borderRadius,
borderColor: style.borderColor,
borderWidth: style.borderWidth
}
}]
if (this.coverType === 'image') {
tags.push({
tag: 'img',
position,
src: this.coverContent
} : {
})
} else {
const lineSpacing = parseFloat(style.lineHeight) - parseFloat(style.fontSize)
let width = parseFloat(position.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight)
width = width < 0 ? 0 : width
let height = parseFloat(position.height) - parseFloat(style.paddingTop) - lineSpacing / 2 - parseFloat(style.paddingBottom)
height = height < 0 ? 0 : height
tags.push({
tag: 'font',
position,
position: {
top: `${parseFloat(position.top) + parseFloat(style.paddingTop) + lineSpacing / 2}px`,
left: `${parseFloat(position.left) + parseFloat(style.paddingLeft)}px`,
width: `${width}px`,
height: `${height}px`
},
textStyles: {
align: textAlign[style.textAlign] || style.textAlign,
color: style.color,
decoration: 'none',
lineSpacing: (parseFloat(style.lineHeight) - parseFloat(style.fontSize)) + 'px',
margin: style.padding,
lineSpacing: `${lineSpacing}px`,
margin: '0px',
overflow: style.textOverflow,
size: style.fontSize,
verticalAlign: 'top',
......@@ -66,8 +78,9 @@ export default {
whiteSpace: style.whiteSpace
},
text: this.coverContent
}
]
})
}
return tags
}
},
mounted () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册