Skip to content

Commit

Permalink
Merge branch 'hotfix/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuna committed Dec 23, 2019
2 parents 97a0884 + 065742a commit 8fd857e
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

[Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## 1.2.1 - 2019-12-20
### Changed
- 添加`$stageWidth``$stageHeight`字段,用于舞台宽高的属性访问

### Fixed
- 修改模板解析调用characters方法时,换行符未处理,导致报错的问题

## 1.2.0 - 2019-12-19
### Changed
- 修改渲染方法及VueEgret暴露的方法,所有显示对象不再创建`egret.DisplayObjectContainer`进行包裹,而是直接使用root作为节点
Expand Down
2 changes: 1 addition & 1 deletion dist/vue.egret.js

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion dist/vue.egret.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,20 @@ var Component = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(Component.prototype, "$stageWidth", {
get: function () {
return this.__global.stage.width;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Component.prototype, "$stageHeight", {
get: function () {
return this.__global.stage.height;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Component.prototype, "_data", {
get: function () {
return this.__data;
Expand Down Expand Up @@ -917,7 +931,7 @@ var ParserFactory = (function () {
};
ParserFactory.prototype.characters = function (text) {
if (this._target) {
this._target.text = text.replace(/^\s+|\s+$/g, '');
this._target.text = text.replace(/^\s+|\s+$|\r|\n/g, '');
}
};
ParserFactory.prototype.addIfConditions = function (exp, prev) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-egret",
"version": "1.2.0",
"version": "1.2.1",
"description": "Egret MVVM",
"main": "dist/vue.egret.js",
"typings": "src/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export declare class Component {
$tweenPromise(tween: egret.Tween): Promise<egret.Tween>;
readonly $refs: ComponentMap<egret.DisplayObject | Component>;
readonly $stage: egret.Stage;
readonly $stageWidth: number;
readonly $stageHeight: number;
readonly _data: any;
_props: any;
readonly _render: Render;
Expand Down
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,25 @@ export class Component {
}
/**
* 获取舞台信息
* @return { egret.Stage }
*/
public get $stage():egret.Stage {
return this.__global.stage
}
/**
* 获取舞台宽度
* @return { number }
*/
public get $stageWidth():number {
return this.__global.stage.width
}
/**
* 获取舞台高度
* @return { number }
*/
public get $stageHeight():number {
return this.__global.stage.height
}
public get _data():any {
return this.__data;
}
Expand Down
12 changes: 10 additions & 2 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ export default class ParserFactory implements ParseHtmlOptions {
comment(text:string){
}

/**
*
* @param { string } text
*/
characters(text:string){
if(this._target){
this._target.text = text.replace(/^\s+|\s+$/g, '')
//去掉头尾空白,以及换行符
this._target.text = text.replace(/^\s+|\s+$|\r|\n/g, '')
}
//this._command.push(new CommandText(this.vm, this._target, text))
}

/**
Expand All @@ -88,6 +92,10 @@ export default class ParserFactory implements ParseHtmlOptions {
return exp
}

/**
* 获取根语法树节点
* @get { ASTNode } root
*/
public get root():ASTNode {
return this._root;
}
Expand Down

0 comments on commit 8fd857e

Please sign in to comment.