🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

element3-core

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element3-core - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+23
src/components/switch/Switch.tsx
import { defineComponent, h } from "vue";
export default defineComponent({
props: ["modelValue"],
setup(props, { emit }) {
const toggle = () => {
emit("update:modelValue", !props.modelValue);
};
const onClick = () => {
toggle();
};
return {
onClick,
};
},
render() {
const children = this.$slots.default?.() || [];
// todo 使用 jsx 可以优化生成的 vnode
return h("button", { onClick: this.onClick }, children);
},
});
+20
-5
import { defineComponent, h } from 'vue';
var script = defineComponent({
var Switch = defineComponent({
props: ["modelValue"],
setup(props, { emit }) {
const toggle = () => {
emit("update:modelValue", !props.modelValue);
};
const onClick = () => {
toggle();
};
return {
onClick,
};
},
render() {
return h("button", "hi");
const children = this.$slots.default?.() || [];
// todo 使用 jsx 可以优化生成的 vnode
return h("button", { onClick: this.onClick }, children);
},
});
script.__file = "src/components/switch/Switch.vue";
export { script as Switch };
export { Switch };
+1
-1
{
"name": "element3-core",
"version": "0.0.3",
"version": "0.0.4",
"description": "headless ui components library",

@@ -5,0 +5,0 @@ "main": "dist/element3-core.esm.js",

@@ -1,3 +0,3 @@

import Switch from "./Switch.vue";
import Switch from "./Switch";
export { Switch };
import { mount } from "@cypress/vue";
import Switch from "./Switch.vue";
import { ref } from "vue";
import Switch from "./Switch";
describe("Switch", () => {
it("test", () => {
it("init", () => {
mount(Switch);
});
it("toggle", () => {
const Comp = {
template: `
<div>
{{boo}}
<Switch v-model="boo"></Switch>
</div>
`,
components: {
Switch,
},
setup() {
const boo = ref(true);
return {
boo,
};
},
};
mount(Comp);
cy.contains("true");
cy.get("button").click();
cy.contains("false");
});
it("slots", () => {
const Comp = {
template: `
<div>
<Switch>hi,element3-core switch</Switch>
</div>
`,
components: {
Switch,
},
};
mount(Comp);
cy.contains("hi,element3-core switch");
});
});
<script lang="ts">
import { defineComponent, h } from "vue";
export default defineComponent({
render() {
return h("button", "hi");
},
});
</script>