-
-
Notifications
You must be signed in to change notification settings - Fork 148
v2.2.3 compile error #27
Comments
Share steps to reproduce the error! |
<template>
<transition :name="effect" @after-leave="afterLeave">
<div class="u-dialog" :class="dialogClass" v-if="rendered">
<div class="dialog-wrapper">
<slot></slot>
</div>
<div class="dialog-mask" @touchmove.stop.prevent></div>
</div>
</transition>
</template>
<style>
</style>
<script>
export default {
props: {
rendered: {
type: Boolean,
default: false
},
effect: {
type: String,
default: 'bounce'
},
dialogClass: {
type: String,
default: ''
}
},
methods: {
afterLeave() {
this.$destroy(); //动画结束 立即摧毁
document.body.removeChild(this.$el);
}
}
};
</script> compile to (function(){
'use strict';
var dialog = { render: function () {
with(this) {
return _h('transition', { attrs: { "name": effect }, on: { "after-leave": afterLeave } }, [rendered ? _h('div', { staticClass: "u-dialog", class: dialogClass }, [_h('div', { staticClass: "dialog-wrapper" }, [_t("default")]), _h('div', { staticClass: "dialog-mask", on: { "touchmove": function ($event) {
$event.stopPropagation();$event.preventDefault();
} } })]) : _e()]);
}
}, staticRenderFns: [],
props: {
rendered: {
type: Boolean,
default: false
},
effect: {
type: String,
default: 'bounce'
},
dialogClass: {
type: String,
default: ''
}
},
methods: {
afterLeave: function () {
this.$destroy(); //动画结束 立即摧毁
document.body.removeChild(this.$el);
}
}
};
}); console output |
Compiled code is apparently correct. The warning may be caused by any post processing library. Try using this rollup config file (rollup.config.js). And compile with rollup -c --input MyComponent.vue |
Compile the results are indeed correct. But |
|
I have the same issue, here my rollup config: import vue from 'rollup-plugin-vue';
import babel from 'rollup-plugin-buble';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
export default {
entry: 'assets/js/main.js',
dest: 'dist/js/main.js',
format: 'iife',
plugins: [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
vue({compileTemplate: true}),
babel(),
],
}; Should i change something to make it work? |
Check out this gist. https://gist.github.com/znck/140d5e9deabfa41f2e935d053a59f23e It is difficult to reproduce this error. Give me exact version of |
$ node -v
v6.6.0
$ npm -v
3.10.7
$ ./node_modules/.bin/rollup -v
rollup version 0.36.0 I'm using the latest Manjaro Linux distribution. BTW, i tried the configs with vue 2.0.0-rc.7 and here how i imported vue in |
<template>
<div class="m-lottery-button">
<a class="lottery-btn" :disabled="busy" v-tap.stop.prevent @tap="start()">{{text}}</a>
<div class="lottery-count">
你还有<b>{{join_count}}</b>次抽奖机会
</div>
</div>
</template> compile to template: "<div class=m-lottery-button><a class=lottery-btn :disabled v-tap.stop.prevent @tap=start()>{{text}}</a><div class=lottery-count>你还有<b>{{join_count}}</b>次抽奖机会</div></div>"
compileTemplate:false |
It uses You can override these: import vue from 'rollup-plugin-vue';
export default {
plugins: [
vue({ htmlMinifier: { /* Override default. */} })
],
}; |
You should disable strict mode in Rollup: https://github.com/thgh/rollup-plugin-vue2#strict-mode-disabled |
Uncaught SyntaxError: Strict mode code may not include a with statement
Issues with
with(this)
v2.2.3 code not change,Whether you forgot to add code change?
The text was updated successfully, but these errors were encountered: