组件使用
对于wangeditor的使用:
在wangditor中,通过v-model实现数据的双向绑定,在此组件有两个方法,分别是getHtml()获得Html内容和getText()获得纯文本内容
接收父组件传过来的数据
let props = defineProps({
modelValue: String,
height: {
type: Number,
default: 500,
},
contentText:String
});
通过watchEffect深度监视实现值的变化赋值给子组件,通过handleChange发布信息,检测子组件数据的变化,自动告诉父组件
watchEffect(()=>{
editorHtml.value=props.modelValue
contentText.value=props.contentText
},{deep:true})
// 获取编辑器实例html
const emit = defineEmits(['update:modelValue','update:contentText']);
const handleChange = (editor) => {
editorHtml.value=editor.getHtml()
contentText.value=editor.getText()
emit('update:modelValue', editorHtml.value);
emit('update:contentText', contentText.value);
};
nvm的下载使用,通过在官网下载nvm-setup.zip安装nvm
在系统的高级配置中配置环境变量
在下载的文件夹找到setting.txt文件,添加镜像源
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/
在终端下载相应的版本:
nvm install 22.11.0或者nvm install 14.12.0
切换版本:
nvm use +版本号
组件使用
http://localhost:8090//archives/zu-jian-shi-yong