File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed
Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -85,13 +85,17 @@ defineProps({
8585
8686const internalModel = ref ([]);
8787
88- watch (model, () => {
89- internalModel .value = model .value ;
88+ watch (model, (newValue ) => {
89+ if (JSON .stringify (newValue) === JSON .stringify (internalModel .value )) return ;
90+
91+ internalModel .value = JSON .parse (JSON .stringify (model .value ));
9092}, { immediate: true });
9193
92- watch (internalModel, () => {
93- model .value = internalModel .value ;
94- });
94+ watch (internalModel, (newValue ) => {
95+ if (JSON .stringify (newValue) === JSON .stringify (model .value )) return ;
96+
97+ model .value = JSON .parse (JSON .stringify (internalModel .value ));
98+ }, { deep: true });
9599
96100function addInput () {
97101 internalModel .value .push ({
Original file line number Diff line number Diff line change @@ -46,13 +46,26 @@ export const Template = (args) => ({
4646 setup() {
4747 return { args };
4848 },
49+ data() {
50+ return {value: [
51+ {
52+ id: ' 1' ,
53+ value: ' Opção 1' ,
54+ },
55+ {
56+ id: ' 2' ,
57+ value: ' Opção 2' ,
58+ },
59+ ]};
60+ },
4961 template: /* html*/ `
5062 <cds-multiInput
5163 v-bind="args"
64+ v-model="value"
5265 /> ` ,
53- methods: {
54- handleEmit( value ) { console .info (' value : ' , value ); }
55- }
66+ updated() {
67+ console .info (' %cv-model : ' , ' color: #2C70CD; ' , this . value );
68+ },
5669});
5770
5871
You can’t perform that action at this time.
0 commit comments