Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

fix: 🐛 fix compiled results with staticRenderFns in some case #74

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

sicau-hsuyang
Copy link
Contributor

Checklist

我使用varlet作为组件库的架子搭建自己的组件库,在某些极端的场景下,编译结果可能会有部分来自于staticRenderFns,而varlet编译的产物没有处理staticRenderFns,导致template中编写的源码丢失:

示例组件:

<template>
  <div class="ali-verification-wrap">
    <div id="captcha-element"></div>
    <div id="captcha-button"></div>
  </div>
</template>

<script>
import { defineComponent } from '../utils/create'
import { props } from './props'

export default defineComponent({
  name: 'AliVerification',
  props,
})
</script>

<style lang="scss">
#aliyunCaptcha-title {
  font-size: 0.45rem !important;
}
</style>

编译结果:

//
//
//
//
//
//
//

import { defineComponent } from '../utils/create';
import { props } from './props';
var render = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _vm._m(0);
};
var staticRenderFns = [function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c('div', {
    staticClass: "ali-verification-wrap"
  }, [_c('div', {
    attrs: {
      "id": "captcha-element"
    }
  }), _vm._v(" "), _c('div', {
    attrs: {
      "id": "captcha-button"
    }
  })]);
}];
export default defineComponent({
  render,
  name: 'AliVerification',
  props
});

Change information

补充组件staticRenderFns选项

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
varlet-vue2 ❌ Failed (Inspect) Jan 8, 2025 7:37am

@haoziqaq haoziqaq merged commit 1a19ef1 into varletjs:dev Jan 8, 2025
1 check failed
@haoziqaq
Copy link
Member

haoziqaq commented Jan 8, 2025

我们后续可能不会投入精力在这个仓库,如果对这个仓库有依赖建议 fork 之后二次开发独立发布,会更方便一些~ 🌹

@haoziqaq
Copy link
Member

haoziqaq commented Jan 8, 2025

release v0.2.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants