refactor: use toRef instead of watching a function, mute rollup for mixed use of default/named export

This commit is contained in:
Justineo
2021-02-23 19:02:45 +08:00
parent c1bf3695cc
commit 175d823200
2 changed files with 5 additions and 2 deletions

View File

@ -31,11 +31,13 @@ const options = [
{ {
file: "dist/index.cjs.js", file: "dist/index.cjs.js",
format: "cjs", format: "cjs",
exports: "named",
sourcemap: true sourcemap: true
}, },
{ {
file: "dist/index.cjs.min.js", file: "dist/index.cjs.min.js",
format: "cjs", format: "cjs",
exports: "named",
sourcemap: true, sourcemap: true,
plugins: [ plugins: [
terser({ terser({

View File

@ -79,8 +79,9 @@ export default defineComponent({
); );
const { autoresize, manualUpdate, loading } = toRefs(props); const { autoresize, manualUpdate, loading } = toRefs(props);
const theme = toRef(props, "theme");
const initOptions = toRef(props, "initOptions");
const loadingOptions = toRef(props, "loadingOptions"); const loadingOptions = toRef(props, "loadingOptions");
const a = toRef(props, "autoresize");
function init(option?: Option) { function init(option?: Option) {
if (chart.value || !root.value) { if (chart.value || !root.value) {
@ -170,7 +171,7 @@ export default defineComponent({
); );
watch( watch(
[() => props.theme, () => props.initOptions], [theme, initOptions],
() => { () => {
cleanup(); cleanup();
init(); init();