Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
anchengjian committed Mar 9, 2018
1 parent e99ef87 commit ebb325f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue",
"version": "1.0.0",
"version": "1.0.1",
"description": "Vue.js in mini program",
"main": "dist/vue.runtime.common.js",
"module": "dist/vue.runtime.esm.js",
Expand Down Expand Up @@ -54,10 +54,10 @@
"author": "anchengjian",
"contributors": [
{
"name" : "hucq"
"name": "hucq"
},
{
"name" : "aOrz"
"name": "aOrz"
}
],
"license": "MIT",
Expand Down
25 changes: 22 additions & 3 deletions packages/mpvue-template-compiler/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@ var camelize = cached(function (str) {
*/



/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
.replace(hyphenateRE, '$1-$2')
.toLowerCase()
});

/**
* Simple bind, faster than native
Expand Down Expand Up @@ -4124,6 +4133,7 @@ function mark (path, deps, iteratorArr) {
var iterator1 = path.iterator1;
var events = path.events;
var directives = path.directives;
var ifConditions = path.ifConditions;

var currentArr = Object.assign([], iteratorArr);

Expand All @@ -4141,10 +4151,19 @@ function mark (path, deps, iteratorArr) {
});
}

// fix: v-else events
if (ifConditions && ifConditions.length && !ifConditions._handled) {
ifConditions._handled = true;
ifConditions.forEach(function (v, i) {
mark(v.block, deps, currentArr);
});
}

// for mpvue-template-compiler
// events || v-model
var hasModel = directives && directives.find(function (v) { return v.name === 'model'; });
var needEventsID = events || hasModel;

if (needEventsID) {
var eventId = getWxEleId(deps.eventIndex, currentArr);
// const eventId = getWxEleId(eIndex, currentArr)
Expand Down Expand Up @@ -4600,17 +4619,17 @@ function convertAst (node, options, util) {

var children = node.children;
var ifConditions = node.ifConditions;
var tagName = node.tag;
var staticClass = node.staticClass; if ( staticClass === void 0 ) staticClass = '';
var mpcomid = node.mpcomid;
var tagName = node.tag;
var log = util.log;
var deps = util.deps;
var slots = util.slots;
var slotTemplates = util.slotTemplates;
var wxmlAst = Object.assign({}, node);
var moduleId = options.moduleId;
var components = options.components;

wxmlAst.tag = tagName = tagName ? hyphenate(tagName) : tagName;
// 引入 import, isSlot 是使用 slot 的编译地方,意即 <slot></slot> 的地方
var isSlot = tagName === 'slot';
if (isSlot) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mpvue-template-compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpvue-template-compiler",
"version": "1.0.0",
"version": "1.0.1",
"description": "mpvue template compiler for Vue",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mpvue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4144,7 +4144,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});

Vue$3.version = '1.0.0';
Vue$3.version = '1.0.1';

/* globals renderer */

Expand Down
2 changes: 1 addition & 1 deletion packages/mpvue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpvue",
"version": "1.0.0",
"version": "1.0.1",
"description": "Vue Runtime for mini program",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit ebb325f

Please sign in to comment.